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
@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
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
Thanks
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/”,
“complete_checkout_url”=>“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.
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.
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
1 Like
Thanks for your reply. its the right solution and you also use the session and cookie for save this id or response you want.
1 Like
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