php - how to execute Future payments on server-side -
i've completed 1st 2 steps mention on link , working on 3rd step "call payment api, using back-end server."
for step 3, have access_token, corelation id , amount
i've found next code step3 in curl. so, i've converted next curl command php code, i've 2 questions:
1) converted correctly?
2) if yes, can issue getting blank page in response paypal ?
curl code:
curl 'https://api.paypal.com/v1/payments/authorization/4td55050sv609544l/capture' \ -h "content-type: application/json" \ -h "paypal-application-correlation-id: c2edbd6e97b14ff2b19ddb8eec9d264c" \ -h "authorization: bearer wfxdnxmyjtdf4q59ofxuquaak6eev-njm6puht3nk3w" \ -d '{ "amount":{ "currency":"usd", "total":"1.50" }, "is_final_capture":true }'
this i've tried understanding, on basis of above code :
static public function executepayment2( $refresh_token, $correlation_id, $fee_amount ) { $data = array( "amount" => array( "currency" => "usd", "total" => $fee_amount ), "is_final_capture" => "true" ); $data_string = json_encode($data); $ch = curl_init( "https://api.paypal.com/v1/payments/authorization/4td55050sv609544l/capture" ); curl_setopt_array( $ch, array( curlopt_customrequest => "post", curlopt_httpheader => array( 'content-type: application/json', 'content-length: ' . strlen($data_string), 'authorization: bearer ' . $refresh_token, //need set $refresh_token 'paypal-application-correlation-id: ' . $correlation_id //need set $correlation_id ), curlopt_postfields => $data_string, curlopt_returntransfer => true ) ); $result = curl_exec( $ch ); //make happen , store response }
when integrate mobile app paypal mobile sdk 2.0, customers can give permission billed multiple times in future without logging paypal account. paypal payments (not credit cards) supported. basic...
php paypal paypal-sandbox
No comments:
Post a Comment