How new SDK API V2 can make direct payment using card

GetTaxSolutions
New Community Member

I have to migrate from legacy API V1. The work-flow there was:

1. Get Paypal access token which is used to call the API.

2. Create payment using https://api.sandbox.paypal.com/v1/payments/payment

    * Pass this request into the body:

{ "intent": "sale", "payer": { "payment_method": "credit_card", //"paypal" for Live environment "funding_instruments": [{ "credit_card": { "number": "<removed>", "type": "visa", "expire_month": 11, "expire_year": 2020, "cvv2": "<removed>", "first_name": "Yordan", "last_name": "<removed>", "billing_address": { "line1": "<removed>", "city": "Saratoga", "state": "CA", "postal_code": "<removed>", "country_code": "US" } } }] }, "transactions": [{ "amount": { "total": "7.47", "currency": "USD", "details": { "subtotal": "7.41", "tax": "0.03", "shipping": "0.03" } }, "description": "The payment transaction description." }] }

3. This using card and payment transaction is completed

 

Actually this create and complete payment just in one call to the API V1.

 

How I can do the same in new API using CreateOrder? Can you someone send me example request? I have my own textboxes which collect the card info and send it to the server.

 

PS. I tried to create new order and Capture after then using this body:

{ "payment_source": { "card": { "name": "Yordan <removed>", "number": "<removed>", "expiry": "2020-11", "security_code": "<removed>", "card_type": "VISA" } } }

It's return:

{ "name": "INVALID_REQUEST", "message": "Request is not well-formed, syntactically incorrect, or violates schema.", "debug_id": "b50c683131782", "details": [ { "field": "/payment_source/card/card_type", "value": "VISA", "location": "body", "issue": "INVALID_PARAMETER_SYNTAX", "description": "The value of a field does not conform to the expected format." } ], "links": [ { "href": "https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_PARAMETER_SYNTAX", "rel": "information_link", "encType": "application/json" } ] }

Without card_type which is not required the message is: 

{ "name": "RESOURCE_NOT_FOUND", "details": [ { "location": "path", "issue": "INVALID_RESOURCE_ID", "description": "Specified resource ID does not exist. Please check the resource ID and try again." } ], "message": "The specified resource does not exist.", "debug_id": "abd5925810d9f", "links": [ { "href": "https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_RESOURCE_ID", "rel": "information_link", "method": "GET" } ] }

 

What I'm doing wrong? Where I can find documentation for this flow for new SDK API V2? I just have all card details and want to complete the payment server side.

 

 

 

 

 

 

 

Login to Me Too
3 REPLIES 3

JackpotRising
New Community Member

card_type should just be type

Login to Me Too

rahul-dighe
PayPal Employee
PayPal Employee

card processing in this manner is a vetted product and still in pilot. Please talk to your account manager or reply back if you still have questions and we can get the help you needed. 

Senior Product Manager - PayPal Checkout API Product
Login to Me Too

VladimirMain
Contributor
Contributor

Hello everyone!

Is this problem solved now or not yet? If the problem is resolved, then please provide a link to reference materials.

 

 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.