Set up checkout

DOCS

Last updated: Sept 23rd, 6:12pm

For every checkout session, your client workflow should follow these steps:

  1. Get an order ID
  2. Call one of the three checkoutWith methods (for the appropriate payment method type) with an orderID.
  3. After a successful checkout result, capture the payment or authorize then capture the payment.

Get an Order ID

Send the orderID that was generated on your server to your client.

    1func fetchOrderID() {
    2
    3 // Switch this URL to your own authenticated API
    4 let orderIDURL = NSURL(string: "https://my-merchant-server.com/order_id")!
    5 let orderIDRequest = NSMutableURLRequest(url: orderIDURL as URL)
    6
    7 URLSession.shared.dataTask(with: orderIDRequest as URLRequest) { (data, response, error) -> Void in
    8 // Handle errors
    9 // Obtain orderID
    10 self.orderID = String(data: data!, encoding: String.Encoding.utf8)
    11
    12 }.resume()
    13}

    Next step

    Set up different ways to pay: