Last active
August 29, 2015 14:16
-
-
Save spencerhunter/e4c178b1a77fa47b0aa4 to your computer and use it in GitHub Desktop.
Dwolla Off-Site Gateway - Generate checkoutID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'https://uat.dwolla.com/oauth/rest/offsitegateway/checkouts'; | |
$dwollaJson = array( | |
'client_id' => '*******', | |
'client_secret' => '*******', | |
'callback' => 'http://requestb.in/164go6s1', | |
'redirect' => 'https://purple.com', | |
'orderId' => 'test123', | |
'test' => 'false', | |
'allowFundingSources' => true, | |
'allowGuestCheckout' => true, | |
'purchaseOrder' => array( | |
'orderItems' => array( | |
'name' => 'Prime Rib Sandwich', | |
'description' => 'A somewhat tasty non-vegetarian sandwich', | |
'quantity'=> '1', | |
'price'=> '15.00' | |
), | |
'destinationId' => '812-741-5935', | |
'total' => 15.00, | |
'notes' => 'notes test' | |
) | |
); | |
$dwollaJson = json_encode($dwollaJson); | |
// create a new cURL resource | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
// tell curl to use HTTP POST | |
curl_setopt($ch, CURLOPT_POST, 1); | |
// tell curl that this is the body of the POST | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $dwollaJson); | |
// set HTTP HEADER fields | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json')); | |
// obtain response | |
$response = curl_exec($ch); | |
curl_close($ch); | |
// print everything out | |
print_r($response); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment