Skip to main content

Update subscription payment information

Last updated: 05-May-2021
Rate this article:

Overview

Use the updateSubscriptionPaymentInformation method to update the credit card information related to the payment to be made for a subscription. To be able to do this, you need to generate a payment token using the credit card information via the 2Pay.js library, and then use this token in the request of the method as indicated below.

Request Parameters

Parameter Name Type Required/Optional Description

sessionID

String

Required

The session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes.

subscriptionReference

String

Required

The reference of the subscription for which you want to retrieve the payment information.

paymentInformation

Object

Required

The payment information object, details below:

PaymentDetails

Object

Required

The payment details object, details below:

Type

String

Required

The payment details type. Restricted to EES_TOKEN_PAYMENT for now.

PaymentMethod

Object

Required

The payment method object, details below:

EesToken

String

Required

The 2Pay token obtained by integrating the 2Pay.js library.

Request Example

<?php
require ('PATH_TO_AUTH');

$subscriptionReference = 'NQHC3LY8TR';

$paymentInformation = new \stdClass();

$paymentDetails = new \stdClass();
$paymentDetails->Type = 'EES_TOKEN_PAYMENT';

$paymentDetails->PaymentMethod = new \stdClass();
$paymentDetails->PaymentMethod->EesToken = 'e17c8251-9efb-4246-ab12-ecb082284c26';

$paymentInformation->PaymentDetails = $paymentDetails;

try {
        $paymentInformationUpdateResponse = $client->updateSubscriptionPaymentInformation ($sessionID, $subscriptionReference, $paymentInformation);
        
    } catch (SoapFault $e) {
        echo  'SOAP Exception caught: ' . $e->getMessage();
    }

Response

The method responds with Boolean True when the payment information update was successfully performed.
Otherwise, in case of validation or access rights failures, it returns the usual error response with specific messages indicating the cause of the failure.

Rate this article:
Logo of Verifone