Skip to main content
knowledgecenter.2checkout.com

Payment flow with 1-Click Purchase

Overview

2Checkout supports 1-click purchases for returning customers who paid for their previous orders with credit cards or PayPal. 

Availability

Available for all 2Checkout accounts.

Requirements

In order to use the 1-click purchase payment method, you need to have this setting enabled on your 2Checkout account. Please contact the Merchant Support team in order to enable this.

How 1-click purchase works

In order to place an order with a previous order reference (1-click purchase), you need to validate that a previous order reference is valid for use. 

This can be done via the 2Checkout API by calling the isValidOrderReference method (SOAP and JSON-RPC) and GET/paymentmethods​/PREVIOUS_ORDER​/refno​/{OrderReference}​/ (on REST). This API method will return 'True' (for order references that can be used), or 'False' (if not).

2Checkout will charge returning customers using their payment-on-file information, either a card or their PayPal account. 

Payment method Object structure

Field name Type Required/Optional Description

RecurringEnabled

Boolean

Optional

True – shopper checks the auto-renewal checkbox and 2Checkout charges subscription renewals using a recurring billing process.

False – shopper doesn’t check the auto-renewal checkbox.

RefNo

String

Required

Order reference to a previous purchase.

You can use an order for which customers paid with credit/debit cards or with PayPal.

The status of the order should be AUTHRECEIVED or COMPLETE

Check the validity of references with the isValidOrderReference method. The 2Checkout system blocks you from using references for fraudulent or potentially fraudulent orders.

Request example

The full JSON used to place an order with credit cards would look like:

{   
   "Language":"en",
   "Country":"US",
   "CustomerIP":"10.10.10.10",
   "Source":"Website",
   "ExternalCustomerReference":"externalCustomerId",
   "Currency":"USD",
   "MachineId":"123456789"
   "Items":[
      {
         "Code":"5DCB30C6B0",
         "Quantity":1
      }
   ],
   "BillingDetails":{
      "Email":"example@email.com",
      "FirstName":"Customer First Name",
      "LastName":"Customer Last Name",
      "CountryCode":"US",
      "State":"California",
      "City":"San Francisco",
      "Address1":"Example Street",
      "Zip":"90210"
   },
   "PaymentDetails":{
      "Type":"PREVIOUS_ORDER",
      "Currency":"GBP",
      "CustomerIP":"159.8.170.22",
      "PaymentMethod":{
         "RecurringEnabled":false,
         "RefNo":"224497479"
      }
   },
}

The API will respond with the full order object (for orders placed successfully) or an error message.

Notes on using the 1-click purchase payment method

  • Use only references to previous orders with one of the following statuses AUTHRECEIVED or COMPLETE.
  • The email address of the BillingDetails object is mandatory and it needs to match the email address used as a part of the billing details of the initial order whose reference you're now using to place a new order. 2Checkout checks whether the email addresses are identical and throws an error if they're not, blocking the order placement process. 
    • You need to provide only the email address of the shopper and can ignore the rest of the required customer billing information. If you enter any billing details in addition to the email address, you'll have to provide all information required in the BillingDetails object.

Integration test cases

  1. Build a request with all the relevant information in order to place a new order. Make sure that when the order is sent in the API the response contains an order object (order was placed successfully).
  2. Make sure that you validate the order so that it can be used for a 1-click purchase before placing the order.
  3. If you have any additional webhook integrations, make sure that the webhooks are correctly configured and that the notifications are received and processed successfully.
  • Was this article helpful?