forked from tjmehta/rest-api-sdk-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.js
74 lines (70 loc) · 1.82 KB
/
update.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
/* Copyright 2015 PayPal */
"use strict";
var paypal = require('../../');
require('../configure');
var invoiceId = "INV2-9DRB-YTHU-2V9Q-7Q24";
var update_invoice_json = {
"id": invoiceId,
"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": 400.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": "2000.00"
}
};
paypal.invoice.update(invoiceId, update_invoice_json, function (error, invoice) {
if (error) {
console.log(error.response);
throw error;
} else {
console.log("Update Invoice Response");
console.log(invoice);
}
});