我已完成对此link的前两个步骤的提及,并在第三步"使用您的后端服务器调用付款API。"
对于第3步,我有 access_token ,核心化ID 和金额
我发现curl中的step3代码如下。所以,我已经将 curl命令转换为PHP代码,为此我提出了两个问题:
1)它是否正确转换?
2)如果是,那么从PayPal获取空白页面的问题可能是什么?
卷曲代码:
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
}'
根据上述代码,这就是我的理解:
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 to set $refresh_token
'Paypal-Application-Correlation-Id: ' . $correlation_id //Need to set $correlation_id
),
CURLOPT_POSTFIELDS => $data_string,
CURLOPT_RETURNTRANSFER => true
)
);
$result = curl_exec( $ch ); //Make it all happen and store response
}
答案 0 :(得分:0)
当您将移动应用与PayPal Mobile SDK 2.0集成时,您的客户可以在未注册其PayPal帐户的情况下,允许将来多次结算。支持PayPal付款(不是信用卡)。基本...