-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpostinvoicepayments.php
More file actions
39 lines (36 loc) · 1.25 KB
/
postinvoicepayments.php
File metadata and controls
39 lines (36 loc) · 1.25 KB
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
<?php
/*
Author: Sunil Bhatt
App: Myob Api
*/
session_start();
include_once('config.php');
include_once('myobsbfunctions.php');
$postinvoicepaymentsclass = new myobsbfunctions($_SESSION['access_token'],api_key);
// Get Last Payment Reference
$getpaymentreference = $postinvoicepaymentsclass->getResponse(api_url."{business_uid}/sale/payments/nextReference");
$getpaymentreference = json_decode($getpaymentreference);
$postinvoicepaymentsJsonData = '{
"paymentDate" : "2018-02-13",
"reference" : "'.$getpaymentreference->reference.'",
"notes" : "Payment for widgets Test",
"account" : {
"uid" : "{account_uid}"
},
"customer": {
"uid" : "{contact_uid}"
},
"invoices": [
{
"invoice" : {
"uid" : "{invoice_uid}"
},
"paymentAmount" : "15.00"
}
]
}';
$postinvoicepayments = $postinvoicepaymentsclass->postData(api_url."{business_uid}/sale/payments", $postinvoicepaymentsJsonData);
$postinvoicepayments = json_decode($postinvoicepayments);
echo "<pre>";
print_r($postinvoicepayments);
echo "</pre>";