Order Api and Authorize Error

dilipmobivana
Contributor
Contributor

Hi,

I am trying to authorize an amount and then after that I want to capture the amount. The steps that I was following to achieve this were:

{

 "number": "4284448849166269",

 "type": "visa",

 "expire_month": 11,

 "expire_year": 2022,

 "cvv2": "198",

 "first_name": "Dilip",

 "last_name": "Mishra",

 "external_customer_id": "dilip_mish[Removed. Phone #s not permitted]

}

The card details that I entered were generated through this url (https://developer.paypal.com/developer/creditCardGenerator/). The response that I received is as follows:

{

  "id": "CARD-99W01372510156918LSQ2TPI",

  "state": "ok",

  "external_customer_id": "dilip_mish[Removed. Phone #s not permitted],

  "type": "visa",

  "number": "xxxxxxxxxxxx6269",

  "expire_month": "11",

  "expire_year": "2022",

  "first_name": "Dilip",

  "last_name": "Mishra",

  "valid_until": "2022-03-31T00:00:00Z",

  "create_time": "2019-04-01T06:03:41Z",

  "update_time": "2019-04-01T06:03:41Z",

  "links": [

    {

      "href": "https://api.sandbox.paypal.com/v1/vault/credit-cards/CARD-99W01372510156918LSQ2TPI",

      "rel": "self",

      "method": "GET"

    },

    {

      "href": "https://api.sandbox.paypal.com/v1/vault/credit-cards/CARD-99W01372510156918LSQ2TPI",

      "rel": "delete",

      "method": "DELETE"

    },

    {

      "href": "https://api.sandbox.paypal.com/v1/vault/credit-cards/CARD-99W01372510156918LSQ2TPI",

      "rel": "patch",

      "method": "PATCH"

    }

  ]

}

{

 "intent": "AUTHORIZE",

 "purchase_units": [

  {

   "amount": {

    "currency_code": "USD",

    "value": "100.00"

   }

  }

 ]

}

The response that I received had:

{

  "id": "97990893Y01469647",

  "links": [

    {

      "href": "https://api.sandbox.paypal.com/v2/checkout/orders/97990893Y01469647",

      "rel": "self",

      "method": "GET"

    },

    {

      "href": "https://www.sandbox.paypal.com/checkoutnow?token=97990893Y01469647",

      "rel": "approve",

      "method": "GET"

    },

    {

      "href": "https://api.sandbox.paypal.com/v2/checkout/orders/97990893Y01469647",

      "rel": "update",

      "method": "PATCH"

    },

    {

      "href": "https://api.sandbox.paypal.com/v2/checkout/orders/97990893Y01469647/authorize",

      "rel": "authorize",

      "method": "POST"

    }

  ],

  "status": "CREATED"

}

{

"payment_source": {

  "token":{

  "id":"CARD-46R66579BJ881893ELSTOKXI",

  "type":"PAYMENT_METHOD_TOKEN",

  "billing_address": {

  "address_line_1": "52 N Main St",

  "admin_area_2": "Johnstown",

  "country_code": "US",

  "postal_code": "43210",

  "admin_area_1": "OH"

 }

  }

 }

}

The response that I received is as follows:

{

  "name": "UNPROCESSABLE_ENTITY",

  "details": [

    {

      "issue": "ORDER_NOT_APPROVED",

      "description": "Payer has not yet approved the Order for payment. Please redirect the payer to the 'rel':'approve' url returned as part of the HATEOAS links within the Create Order call or provide a valid payment_source in the request."

    }

  ],

  "message": "The requested action could not be performed, semantically incorrect, or failed business validation.",

  "debug_id": "3c882d4fb05a7",

  "links": [

    {

      "href": "https://developer.paypal.com/docs/api/orders/v2/#error-ORDER_NOT_APPROVED",

      "rel": "information_link",

      "method": "GET"

    }

  ]

}

 

Now I would like to know that how should I pass the payment_source in authorize api (https://api.sandbox.paypal.com/v2/checkout/orders/97990893Y01469647/authorize) so I do not have to call the approve api (https://www.sandbox.paypal.com/checkoutnow?token=97990893Y01469647) ?

Can I also use card id in payment_source that I received from vault api (https://api.sandbox.paypal.com/v1/vault/credit-cards) to capture an order with 'CAPTURE' as intent?

I was able to do the desired solution using /v1/payments/payment but it is deprecated now. But I still want to do the transaction in same manner.

I would be grateful if you could suggest another way around to this situation, so I can create or store customer card in your vault and process the transaction after that.

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

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