首页 > 代码库 > paypal支付
paypal支付
curl -v https://api.sandbox.paypal.com/v1/oauth2/token \
-H "Accept: application/json" \
-H "Accept-Language: en_US" \
-u "l1nBOzhwEbXGyvXDsenBv2ISkeyHIFQFws2m2R8bLmMXn1:EIHouCN8EnQPb3yhgNK9UdcpmLukFpik4HKiXrMhw9GCX1rW" \
-d "grant_type=client_credentials"
//返回的结果
{"scope":"https://uri.paypal.com/services/subscriptions https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card https://uri.paypal.com/services/applications/webhooks openid https://uri.paypal.com/payments/payouts https://api.paypal.com/v1/vault/credit-card/.*","nonce":"2016-08-26T01:06:34Z7Ai81-WzKSiBdgjN1R4Tl1CfsYVIB9r69zoRqKOkb90","access_token":"A101.H-4awV8i9LoBfMCVyBwfost0YT3pKWP9tZMHm4DRjzTuTi_j.7tAAmBPmz4X8XtpjLY74vRRRzqa","token_type":"Bearer","app_id":"APP-80W28P519543T","expires_in":32400}
curl -v https://api.sandbox.paypal.com/v1/payments/payment \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Access-Token" \
-d ‘{
"intent":"sale",
"redirect_urls":{
"return_url":"http://example.com/your_redirect_url.html",
"cancel_url":"http://example.com/your_cancel_url.html"
},
"payer":{
"payment_method":"paypal"
},
"transactions":[
{
"amount":{
"total":"7.47",
"currency":"USD"
}
}
]
}‘
paypal支付