Help !!!!!!!!!!!!!!!!!!!!! Why can't I get the paymentId through the return_url?

Eternalsun
Contributor
Contributor

I use the /v2/checkout/orders to create order  . 

after I paied the order  i fund the return url only get the token and PayerID 

 

how can i  get the paymentId to do the next step? 

or my request body or request header need to add something????

 

here are my request body:

[
"intent" => "CAPTURE",
"purchase_units" => [[
"reference_id" => $order_no,
"amount" => [
"value" => $amount,
"currency_code" => $currency
]
]],
"application_context" => [
'return_url' => Yii::$app->params['frontend_pc_url'] . self::RETURN_URL,
'cancel_url' => Yii::$app->params['frontend_pc_url'] . self::CANCEL_URL
]
];
Login to Me Too
1 REPLY 1

MTS_Jennifer
Moderator
Moderator

Hello,

Thank you for posting to the PayPal Sandbox Community.

When you post your code to this endpoint https://api.sandbox.paypal.com/v2/checkout/orders you are supposed to get the below in a response:

(This is an example response with an example ID)

{
    "id""7WH62688TU127225Q",
    "links": [
        {
            "rel""self",
            "method""GET"
        },
        {
            "rel""approve",
            "method""GET"
        },
        {
            "rel""update",
            "method""PATCH"
        },
        {
            "rel""capture",
            "method""POST"
        }
    ],
    "status""CREATED"
}
With the correct order id you can run a capture request to this endpoint:
You will receive a response like this (sample transaction id only):
{
    "id": "7WH62688TU127225Q",
    "purchase_units": [
        {
            "reference_id": "default",
            "shipping": {
                "name": {
                    "full_name": "Buyer BuyerTest"
                },
                "address": {
                    "address_line_1": "1 Main St",
                    "admin_area_2": "San Jose",
                    "admin_area_1": "CA",
                    "postal_code": "95131",
                    "country_code": "US"
                }
            },
            "payments": {
                "captures": [
                    {
                        "id": "7SY00088VE388220Q",
                        "status": "COMPLETED",
                        "amount": {
                            "currency_code": "USD",
                            "value": "100.00"
                        },
                        "final_capture": true,
                        "seller_protection": {
                            "status": "ELIGIBLE",
                            "dispute_categories": [
                                "ITEM_NOT_RECEIVED",
                                "UNAUTHORIZED_TRANSACTION"
                            ]
                        },
                        "seller_receivable_breakdown": {
                            "gross_amount": {
                                "currency_code": "USD",
                                "value": "100.00"
                            },
                            "paypal_fee": {
                                "currency_code": "USD",
                                "value": "3.20"
                            },
                            "net_amount": {
                                "currency_code": "USD",
                                "value": "96.80"
                            }
                        },
                        "links": [
                            {
                                "href": "https://api.sandbox.paypal.com/v2/payments/captures/7SY00088VE388220Q",
                                "rel": "self",
                                "method": "GET"
                            },
                            {
                                "href": "https://api.sandbox.paypal.com/v2/payments/captures/7SY00088VE388220Q/refund",
                                "rel": "refund",
                                "method": "POST"
                            },
                            {
                                "href": "https://api.sandbox.paypal.com/v2/checkout/orders/7WH62688TU127225Q",
                                "rel": "up",
                                "method": "GET"
                            }
                        ],
                        "create_time": "2020-03-06T18:52:03Z",
                        "update_time": "2020-03-06T18:52:03Z"
                    }
                ]
            }
        }
    ],
    "payer": {
        "name": {
            "given_name": "Buyer",
            "surname": "BuyerTest"
        },
        "email_address": "buyer.buyer@example.com",
        "payer_id": "{{payer_id}}",
        "phone": {
            "phone_number": {
                "national_number": "408555454"
            }
        },
        "address": {
            "address_line_1": "1 Main St",
            "admin_area_2": "San Jose",
            "admin_area_1": "CA",
            "postal_code": "95131",
            "country_code": "US"
        }
    },
    "links": [
        {
            "href": "https://api.sandbox.paypal.com/v2/checkout/orders/7WH62688TU127225Q",
            "rel": "self",
            "method": "GET"
        }
    ],
    "status": "COMPLETED"
}
Thank you,
Jennifer
PayPal
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.