GET vs POST parameters in the Get Payment Status step

Follow

Merchants may have noticed that in our API documentation for Copy and Pay we list that the re

As long as you're processing synchronous payments only, you'll receive the resourcePath as a POST parameter - an example of this would be payments made using the stored cards or payments where the user's card is not enrolled for 3DSecure.

Only once you use asynchronous payment methods (in the context of credit cards that is 3DS enrolled and user is redirected to the authentication page) you'll get GET parameters.

We would recommend that you please build-in the support for both POST and GET parameters when implementing the Copy and Pay option in our REST API.

Please feel free to contact us on support@peachpayments.com for any questions.

 

Below is also a standard PHP code snippet on how to potentially handle this:

NOTE: The code snippet is illustrative only and does not actually work

$id = '';

$resourcePath = '';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {

    $id = isset($_POST['id']) ? $_POST['id'] : '';

    $resourcePath = isset($_POST['resourcePath']) ? $_POST['resourcePath'] : '';

    } elseif ($_SERVER['REQUEST_METHOD'] === 'GET') {

     $id = isset($_GET['id']) ? $_GET['id'] : '';

     $resourcePath = isset($_GET['resourcePath']) ? $_GET['resourcePath'] : '';

     }

if ($id != '' && $resource_path != '') {

// get the status of the payment

$response = $this->peachhelper->getPaymentStatus($resource_path);

$payment_result = $this->peachhelper->isTransactionSuccess($response);

if ($payment_result->success) {

    $this->paymentmodel->processSuccessfulPaymentResponse($response);

     } else {

    $this->paymentmodel->processFailedPaymentResponse($response);

     }

}

 

Have more questions? Submit a request

Comments

Powered by Zendesk