# Get Body response after complete\_checkout\_url

**URL:** https://community.rapyd.net/t/get-body-response-after-complete-checkout-url/1844
**Category:** 🙋🏽‍♀️🙋🏽‍♂️ Ask Questions
**Tags:** collect-api, payments, hosted-checkout
**Created:** [May 24, 2022, 10:45am UTC](https://community.rapyd.net/t/get-body-response-after-complete-checkout-url/1844 "2022-05-24T10:45:16Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Jack\_Honner](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/jack_honner/32/1743_2.png) [@Jack\_Honner](https://community.rapyd.net/u/Jack_Honner)
#### Post date: [May 24, 2022, 10:45am UTC](https://community.rapyd.net/t/get-body-response-after-complete-checkout-url/1844/1 "2022-05-24T10:45:16Z")

</div>

Hi I am implementing the cheakout page and all working fine i get body response but the I need to redirect the sandbox url page for futher visa or master card payment and then after I click on finish its redirect me to another page and there I want to print id,description how i can redirect page I can get message body.

after sandbox page complete\_checkout\_url. my new page is thanks.php it redirect susscfuly but how i can get message body in the redirect url.

$body = [

```
"amount" => $afaq,

"complete_checkout_url" => "https://example/rapyd/thamks.php/",

"country" => "GB",

```

“description”=\>“my product details etc”;

```
"currency" => "GBP",

"merchant_reference_id" => "950ae8c6-78",

"language" => "en",

"payment_method_types_include" => [

    "gb_mastercard_card",

    "gb_visa_card",

]

```

];

try {

```
$object = make_request('post', '/v1/checkout', $body);

header('Location: ' . $object['data']['redirect_url']); //Sandbox url

 var_dump($object); //there I can get message body

```

} catch (Exception $e) {

```
echo "Error: $e";

```

}

any one can help I want to get payment from master and visa card in cheakoutpage

---

<div class="post-metadata">

### Author: ![fredjinbility](https://avatars.discourse-cdn.com/v4/letter/f/22d042/32.png) [@fredjinbility](https://community.rapyd.net/u/fredjinbility)
#### Post date: [May 24, 2022, 6:10pm UTC](https://community.rapyd.net/t/get-body-response-after-complete-checkout-url/1844/2 "2022-05-24T18:10:13Z")

</div>

@Jack_Honner , You will need to create a persistent session or cookies to track your payments, id, descriptions etc.

On thank you Page you will need to make an API call to Rapyd  
via **Retrieve Checkout Page API** using the **Checkout\_page id**

Use the GET method to retrieve a checkout page.

**// Request URL: GET** [https://sandboxapi.rapyd.net/v1/checkout/checkout\_408606a46b1e1e60507a2b2fc578143c](https://sandboxapi.rapyd.net/v1/checkout/checkout_408606a46b1e1e60507a2b2fc578143c)

From the body message result that display, get the parameter values that you need and you can then make a payments updates where appropriates in your database.

Please see full [Docs](https://docs.rapyd.net/build-with-rapyd/reference/checkout-page-object#create-checkout-page)

Thanks

---

<div class="post-metadata">

### Author: ![Jack\_Honner](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/jack_honner/32/1743_2.png) [@Jack\_Honner](https://community.rapyd.net/u/Jack_Honner)
#### Post date: [May 31, 2022, 2:12pm UTC](https://community.rapyd.net/t/get-body-response-after-complete-checkout-url/1844/3 "2022-05-31T14:12:35Z")

</div>

Hi thanks for your reply

header(‘Content-Type: application/json’);  
$path = “utilities.php”;  
include($path);

$amount = 100;  
$refrence = “my description box”;

$body = [  
“amount”=\>$amount,  
“country” =\> “GB”,  
“currency” =\> “GBP”,  
“cancel\_checkout\_url”=\>“[https://afaq.mobitairportparking.co.uk/](https://afaq.mobitairportparking.co.uk/)”,  
“complete\_checkout\_url”=\>“[https://afaq.mobitairportparking.co.uk/thanks.php](https://afaq.mobitairportparking.co.uk/thanks.php)”,  
“description”=\> $refrence,  
“payment\_method\_options.3d\_required”=\>true,  
“merchant\_reference\_id” =\> “950ae8c6-78”,  
“language” =\> “en”,  
“payment\_method\_types\_include” =\> [  
“gb\_mastercard\_card”,  
“gb\_visa\_card”,  
],  
“capture”=\> true,  
“3DS\_required”=\>true  
];

try {  
$object = make\_request(‘post’, ‘/v1/checkout’, $body);  
header('Location: ’ . $object[‘data’][‘redirect\_url’]);

} catch (Exception $e) {  
echo “Error: $e”;  
}

Now sir i want to get payment id on my thanks.php page I using the session method in PhP but Where i can get the the sussces response i am using the utiiltes.php code not webhook is there any method for to get payment\_id on thanks .php page and aslo tell me brieflly how I can get retrive cheakoutpage I am read all page docs but not understand how the message body we get we on cheakout hosted page and when payment Done its redirect to thanks page. and i am not get response of success message body I only need the final body message with payment\_id Please give the code.

---

<div class="post-metadata">

### Author: ![fredjinbility](https://avatars.discourse-cdn.com/v4/letter/f/22d042/32.png) [@fredjinbility](https://community.rapyd.net/u/fredjinbility)
#### Post date: [May 31, 2022, 3:14pm UTC](https://community.rapyd.net/t/get-body-response-after-complete-checkout-url/1844/4 "2022-05-31T15:14:49Z")

</div>

To get your **Payment Id** , on thank you page. you will need to Retrieve Your Checkout Page Info/Details

The code below will print your payment status, payment id and so on.

```auto

include('utilities.php');

$checkout_pageid = 'your checkout page id goes here';

try {

    $object = make_request('get', "/v1/checkout/$checkout_pageid"); // completed
$json = json_decode(json_encode($object), true);

//$json = json_encode($object, true);
//print_r($json);

if($object==''){

echo "<br><br><div style='background:red;color:white;padding:8px;border:none;'>Payment Query Updates Failed. Try again</div>";
exit();
}

} catch(Exception $e) {
    echo "<div style='background:red;color:white;padding:8px;border:none;'>Error: $e</div>";
}

echo $status_success = $json['status']['status'];
echo $payment_amount = $json['data']['payment']['amount'];
echo $payment_id = $json['data']['payment']['id'];
echo $payment_statusx = $json['data']['payment']['status'];

if($status_success =='SUCCESS'){ // close if for rapyd success

// yourphp andmysql database logic goes here

}

```

let me know if you still have issues

---

<div class="post-metadata">

### Author: ![Jack\_Honner](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/jack_honner/32/1743_2.png) [@Jack\_Honner](https://community.rapyd.net/u/Jack_Honner)
#### Post date: [June 1, 2022, 12:28pm UTC](https://community.rapyd.net/t/get-body-response-after-complete-checkout-url/1844/5 "2022-06-01T12:28:03Z")

</div>

Thanks for your reply. its the right solution and you also use the session and cookie for save this id or response you want.

---

<div class="post-metadata">

### Author: ![fredjinbility](https://avatars.discourse-cdn.com/v4/letter/f/22d042/32.png) [@fredjinbility](https://community.rapyd.net/u/fredjinbility)
#### Post date: [June 1, 2022, 5:42pm UTC](https://community.rapyd.net/t/get-body-response-after-complete-checkout-url/1844/6 "2022-06-01T17:42:56Z")

</div>

If its **Checkout\_Page Id or Payment\_id** , you can initialize it in Session or save in database and then query it later. it all depend on what you are trying to achieve. In case of session, remember to destroy the session once everything is done. Thanks
