forked from robrighter/node-recurly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
79 lines (63 loc) · 2.38 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
var util = require('util');
var Recurly = require('./lib/recurly');
var callback = function(result){
console.log(util.inspect(result));
};
recurly = new Recurly(require('./config'));
// recurly.charges.chargeAccount('[email protected]',{
// amount_in_cents: '850',
// description: 'testing the charge'
// },callback);
//recurly.charges.listAll('[email protected]',callback);
// recurly.coupons.redeemOnAccount('[email protected]', {
// coupon_code: '50PERCENTOFF'
// },callback);
//recurly.coupons.removeFromAccount('[email protected]',callback);
//recurly.coupons.getAssociatedWithAccount('[email protected]',callback);
// recurly.credits.creditAccount('[email protected]',{
// amount_in_cents: 550,
// description: 'Cutting you a break 3'
// }, callback);
//recurly.credits.listAll('[email protected]',callback);
//recurly.invoices.getAssociatedWithAccount('[email protected]',callback);
//recurly.invoices.get('7aba9e26feae42c1acb078fea1024c6f',callback);
//recurly.invoices.invoiceAccount('[email protected]',callback);
//recurly.subscriptions.getAssociatedWithAccount('[email protected]',callback);
//recurly.subscriptionPlans.listAll(callback);
//recurly.subscriptions.refund('[email protected]',callback,'partial');
// recurly.subscriptions.create('[email protected]',{
// plan_code: 'test-plan',
// quantity: 1,
// account: {
// billing_info: {
// first_name: 'berty',
// last_name: 'tester',
// address1: '123 my street',
// address2: '',
// city: 'Chattanooga',
// state: 'TN',
// zip: '37408',
// country: 'US'
// }
// }
// },callback);
// recurly.transactions.createImmediateOneTimeTransaction('[email protected]',{
// account:{
// account_code: 'robrighter'
// },
// amount_in_cents: 600,
// description: 'just testing things out'
// },callback)
var data = {
'account[account_code]': 'demo-1301435036',
'account[username]': 'username123',
'redirect_url': 'http://localhost/subscribe.php',
'subscription[plan_code]': 'test-plan'
}
console.log(recurly.transparent.subscribeUrl());
console.log(recurly.transparent.hidden_field(data));
recurly.transparent.getResults('dfd82a741b3e5f15e32439fb66f7696046138105',//confirm
'31c6f6c96f3045cdbc126934295e889b',//result
'422',//status
'subscription',//type
callback)