Skip to content

Instantly share code, notes, and snippets.

@DmitriySmirnov
Created November 24, 2015 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DmitriySmirnov/0768302795e76712fa25 to your computer and use it in GitHub Desktop.
Save DmitriySmirnov/0768302795e76712fa25 to your computer and use it in GitHub Desktop.
Create payment with PHP
$waApiClient = WaApiClient::getInstance();
$waApiClient->initTokenByApiKey('put_your_apikey_here');
$url = 'https://api.wildapricot.org/v2/Accounts/XXX/Payments';
// I have converted json to array using http://online-code-generator.com/json-decode.php,
// so I'm no 100% sure it is valid.
$data = Array
(
[Value] => 100,
[Invoices] => Array
(
[0] => Array
(
[Id] => 1111
)
),
[Tender] => Array
(
[Id] => 2222
),
[Contact] => Array
(
[Id] => 3333
),
[Comment] => 'Some comment for administrator'
[PublicComment] => 'Some comment visible for contact'
);
$response = $waApiClient->makeRequest($url, 'POST', $data);
echo sprintf("New payment was created. Id:", $response["Id"]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment