Skip to content

Instantly share code, notes, and snippets.

@steve9001
Created May 22, 2012 15:18
Show Gist options
  • Save steve9001/2769709 to your computer and use it in GitHub Desktop.
Save steve9001/2769709 to your computer and use it in GitHub Desktop.
Balanced Payments guest checkout workflow

Workflow for (repeat) guest checkout

  1. In your form, gather email address, credit card, and amount

  2. With balanced.js post the card data to Marketplace cards_uri

  • response is unique card token URI
  • response is never 409 Conflict ; passing the same card will always create a new token
  1. In js callback, post the email address, card token and amount to your server

  2. On your server, post the email plus card URI to the Marketplace accounts_uri to create buyer account.

  • If account (identified by email address) doesn't exist, response includes URI
  • If account exists, response is 409 Conflict.
{"status":"Conflict",
 "category_code":"duplicate-email-address",
 "category_type":"logical",
 "additional":null,
 "status_code":409,
 "description":"Account with email address 'bdb0151@example.com' already exists"}
  • If 409, query the marketplace for the account URI associated with that email address, and associate the card uri with that account using the cards_uri
  1. Finally, use the account URI, the card token, and the amount to make a hold.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment