Advertisement
Guest User

Untitled

a guest
Nov 7th, 2017
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <?php
  2. require_once 'vendor/autoload.php';
  3.  
  4. /**
  5. * This code shows how to use the voucher api
  6. * - clientId can be passed in request body to assiciate the voucher with the given client or it will be associated with a walk in customer
  7. * - serialNumber is optional, if passed the voucher will get that serial number, if not one will be autogenerated
  8. **/
  9.  
  10. $username = 'cloud@rachelbangura.com'; // Contact Phorest support for username
  11. $password = 'WV&FCoA0J!07kOd'; // Contact Phorest support for password
  12.  
  13. $businessId = 'HwuWoFmNI82cyW2LSrDrVQ'; // Contact Phorest support for business id
  14. $apiUrl = 'api-gateway-staging.phorest.com/third-party-api-server/'; // Contact Phorest support for url
  15.  
  16. $uri = 'http://' . $apiUrl . '/third-party-api-server/api/business/' . $businessId . '/voucher';
  17.  
  18. $response = \Httpful\Request::post($uri)
  19. ->authenticateWith($username, $password)->
  20. sendsJson()->body('{
  21. "creatingBranchId": "SE-J0emUgQnya14mOGdQSw",
  22. "expiryDate": "2017-07-11T08:27:23.993Z",
  23. "id": "ab-123",
  24. "issueDate": "2017-07-11T08:27:23.993Z",
  25. "originalBalance": 123.12
  26. }')->send();
  27.  
  28. echo(json_encode($response->body));
  29.  
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement