Store the data as stand-alone

Store the data as stand-alone

With COPYandPAY it is also possible to create a just registration separate from any later payment.

A registration-only transaction with COPYandPAY is basically using the same workflow and parameters as a payment.

You only have to change two parameters in step1:

  • createRegistration=true has to be sent.
  • paymentType should not be sent.

Now COPYandPAY automatically adapts the workflow for handling a registration:

  • In step2 COPYandPAY will render the payment form as usual, but send the form to https://{test.}oppwa.com/v2/checkouts/{checkoutId}/registration
  • In step3 you'll get back a resourcePath pointing to you to query for a registration's result: resourcePath=/v2/checkouts/{checkoutId}/registration

IMPORTANT: The baseUrl (that is prepended to the resourcePath) must end in a "/", e.g. "https://test.oppwa.com/".

1. Prepare the checkout

First, perform a server-to-server POST request to prepare the checkout and set the with the createRegistration to true.

2. Create the registration form

To create the registration form you just need to add the following lines of HTML/JavaScript to your page and populating the following variables

  • The checkout's id that you got in the response from step 1
    <script src="https://test.oppwa.com/v2/paymentWidgets.js?checkoutId={checkoutId}"></script>

3. Get the registration status

Once the registration has been processed, the customer is redirected to your shopperResultUrl along with a GET parameter resourcePath.

Important: The baseUrl must end in a "/", e.g. "https://test.oppwa.com/".

Then, to get the status of the registration, you should make a GET request to the baseUrl + resourcePath, including your authentication parameters.

4. Using the stored payment data for recurring

Based on the stored account details, recurring payments become very simple to achieve.

All you need to do is to add the parameter recurringType to your request to the /checkouts endpoint (see step1):

  • For the initial payment request you should send the recurringType with value INITIAL.
  • For any subsequent payment you should send the recurringType with value REPEATED.

The Recurring Payment tutorial explains this scenario in more detail.