curl - accept payment in paypal from credit card php -
I wanted to accept payment from my store on my store and I did not have to go to PayPal using curl Use tokens but how can I use the code below I think this is the code that I should use for payment.
Curl-V https://api.sandbox.paypal.com/v1/payments/payment \ -H 'Content-Type: Application / Jason' \ -H 'Authority: Bearer { AccessToken} '\ "," redirect_urls ": {" return_url ":" http: // to return here return "," cancel_url ":" http: // " "{Credit}": "credit card"}, "transaction": [{"amount": {"total": "7.47", "currency") and / or cancellation url here & gt; "}" payer ": {" payment_method " : "USD"}, "Description": "This is the transaction transaction statement."}]} '' I would like to use it in curl and pay by sending data to PayPal and J A trick is required to get in the Sun.
& Lt ;? Php // open connection $ ch = class = "post-text" itemprop = "text"> curl_init (); $ Customer = "XXXXXXXXXXXXXXXXXXXXX"; $ Secret = "XXXXXXXXXXXXXXXXXXX"; Curl_setopt ($ ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/oauth2/token"); Curl_setopt ($ CH, CURLOPT_HEADER, incorrect); Curl_setopt ($ CH, CURLOPT_SSL_VERIFYPEER, incorrect); Curl_setopt ($ ch, CURLOPT_POST, true); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, true); Curl_setopt ($ CH, CURLOPT_USERPWD, $ client. ":". $ $ Hidden); Curl_setopt ($ ch, CURLOPT_POSTFIELDS, "grant_type = client_credentials"); $ Result = curl_xac ($ CH); If (empty ($ result) die ("error: no response."); Other {$ json = json_decode ($ result); Print_r ($ json- & gt; ACCESS_TOKEN); } // is now txn after receiving the token $ ch = curl_init (); $ Data = '{"intent": "sale", "redirect_urls": {"return_url": "http: //", & lt; return url here & gt;, "cancel_url": " Lt; cancel & gt; URL here; "}", "donor": {"PAYMENT_METHOD": "CREDIT_CARD", "funding_instruments": [{"CREDIT_CARD": {"number": "5500005555555559", "type": "MasterCard "," Expire_month ": 12," expire_year "{" amount ": {" total ":" 7.47 "," "2017", "cvv2": 111, "first_name": "who", "last_name": "Shopper"}}]}, "transaction" currency ":" USD "}," description ":" This payment is transaction details. "}]}; Curl_setopt ($ CH, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/payments/payment"); Curl_setopt ($ ch, CURLOPT_POST, true); Curl_setopt ($ CH, CURLOPT_SSL_VERIFYPEER, incorrect); Curl_setopt ($ CH, CURLOPT_POSTFIELDS, $ data); Curl_setopt ($ c, CURLOPT_HTTPHEADER, Array ("Content-Type: Application / Jason", "Authority: Carrier". $ Json- & gt; Access_Token);); $ Result = curl_xac ($ CH); If (empty ($ result) die ("error: no response."); Other {$ json = json_decode ($ result); Print_r ($ json); }? & Gt; Answer:
A015dVGr.q9WhQyXl -JnJnkJ.xcFkxJmHmUgCXwYqansoL0 {"id": "58R21143N1956774RKQ365CQ of Payment", "create_time": "2014-10- "", "Subscriber": "Subscriber": "Sale", "Donor": {"PAYMENT_METHOD": "CREDIT_CARD": "10-10: 34: 50Z", "UPDATE_TIME": "2014-10-10T14: 34: 57Z" "" Funding_instruments ": [" CREDIT_CARD ": {" type ":" mastercard "," number ":" xxxxxxxxxxxx5559 "," expire_month ":" 12 "," expire_year ":" 2018 "," first_name ":" which "{{" Total ":" 7.47 "," currency ":" US dollar "," description ": {" sub ":" "" last_name ":" shopkeeper "}}]," transaction ": [{" sum " -yog ":" 7.47 "}}," Details ":" This is a payment transaction details. "," Related_resources ": [{" Sale ": {" id ":" 3, 0008328N18783546 "," create_time ":" 2014-10-10T14: 34: 50Z "," UPDATE_TIME ":" 2014-10-10T14: 34: 57Z "," Zodiac ": {" Total ":" 7.47 " , "Currency": "US dollar"}, "state": "full" "parent_payment": "58R21143N1956774RKQ365CQ of payment", "link": [{"href": "https://api.sandbox.paypal.com / V1 / payments / sale / 3J048328N18783546 "," rel ":" self "" method ":" GET "}, {" href ":" https://api.sandbox.paypal.com/v1/pay statement / sale / 3J048328N18783546 / return "," rel ":" return "," method ":" post "}, {" href ":" https://api.sandbox.paypal.com/v1/payments/payment/ pay -58 R21143N1956774RKQ365CQ "," Rel ":" parent_payment "" method ":" received "}]}}]}]," link ": [{" href ":" https://api.sandbox.paypal.com/v1/payment / Payout / Pay-58R21143 N1956774 KK 365 CQ "," Reliance ":" Self "," method ":" get "}]} 1
Comments
Post a Comment