forked from tjmehta/rest-api-sdk-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.js
70 lines (67 loc) · 1.71 KB
/
create.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
/* Copyright 2015-2016 PayPal, Inc. */
"use strict";
var paypal = require('../../');
require('../configure');
var create_invoice_json = {
"merchant_info": {
"email": "[email protected]",
"first_name": "Dennis",
"last_name": "Doctor",
"business_name": "Medical Professionals, LLC",
"phone": {
"country_code": "001",
"national_number": "5032141716"
},
"address": {
"line1": "1234 Main St.",
"city": "Portland",
"state": "OR",
"postal_code": "97217",
"country_code": "US"
}
},
"billing_info": [{
"email": "[email protected]"
}],
"items": [{
"name": "Sutures",
"quantity": 100.0,
"unit_price": {
"currency": "USD",
"value": 5
}
}],
"note": "Medical Invoice 16 Jul, 2013 PST",
"payment_term": {
"term_type": "NET_45"
},
"shipping_info": {
"first_name": "Sally",
"last_name": "Patient",
"business_name": "Not applicable",
"phone": {
"country_code": "001",
"national_number": "5039871234"
},
"address": {
"line1": "1234 Broad St.",
"city": "Portland",
"state": "OR",
"postal_code": "97216",
"country_code": "US"
}
},
"tax_inclusive": false,
"total_amount": {
"currency": "USD",
"value": "500.00"
}
};
paypal.invoice.create(create_invoice_json, function (error, invoice) {
if (error) {
throw error;
} else {
console.log("Create Invoice Response");
console.log(invoice);
}
});