Simplify Link with OAuth 2.0

How to access Simplify Link using OAuth 2.0

With Simplify Link, Simplify Commerce APIs support OAuth 2.0 through endpoints for your application. We have also added it into the SDKs for easy setup and use. With user approval, your application may access Simplify Commerce APIs when the user is present or not

The documentation below describes how to use Simplify Link when accessing Simplify Commerce APIs from your application.

Simplify Link uses OAuth 2.0 so you can interact with Simplify Commerce without having to store sensitive credentials. Our simple authentication flow makes it easy for your customers to connect their Simplify Commerce accounts while giving you the ability to request several levels of permissions. Users can manage and revoke access to their third-party authorizations using the Simplify Commerce dashboard.

With Simplify Link, OAuth developers can request:

  • Read and Write access to the full Simplify Commerce API
  • Read and Write access to the Payments and Refunds API
  • Read Only permission to the full Simplify Commerce API

Overview

First you will need to go to the apps management section of Simplify Commerce to upload a logo, key pair name, and redirect uri. You will get a public key that will be used for the client_id in the authorization request

The next part of the flow begins with redirecting a browser (popup or full page if needed) to a Simplify Commerce endpoint with the client_id and a response_type of code. Simplify Commerce then responds with an authorization code to the application per the redirect_uri query parameter registered with the account

After the application receives the authorization code, the application can redeem the code for an access token. The application will send the authorization code, the grant type of code, and the redirect uri. You will receive an access token and a refresh token. We recommend using one of our SDKs for ease of use

With the access token you now may access protected Simplify Commerces APIs.

You can also use the SDKs to refresh the access token if the token has expired or revoke a token.

Register Your Application

Applications that wish to utilize Simplify Link to access Simplify Commerces APIs must be registered through the apps setting screen

On this screen, you will upload the company logo (guideline dimensions: 128px x 128px) you wish to appear during authorization, the name of the application, the key type (sandbox or live), and a redirect url

A new private key, public key, and confirmation of the redirect url will then be displayed. Copy down the keys, you will need this for the next step

Creating the URL for Obtaining Authorization Token

Next you will want to request an authorization grant. As the client you will do this by issuing a GET request from the user's user-agent browser to https://www.simplify.com/commerce/oauth/authorize with the following query parameters:


response_type Determines if an authorization code is returned to the redirect url on file. A value of code is required. required

scope
The client is allowed to specify the scope of access using the scope parameter. The valid options are full, payments, or readall.
full
The client will have READ and WRITE access to the following data:
  • - Payments
  • - Refunds
  • - Customers
  • - Plans
  • - Coupons
  • - Subscriptions
payments
The client will have READ and WRITE access to the following data:
  • - Payments
  • - Refunds
readall
The client will have READ ONLY access to the following data:
  • - Payments
  • - Refunds
  • - Customers
  • - Plans
  • - Coupons
  • - Subscriptions
required
client_id The public key obtained when registering your app in the Simplify Commerce app management section. required
state An opaque value used by the client to maintain state between the request and callback. Simplify Commerce includes this value when redirecting the user-agent back to the client. The parameter SHOULD be used for preventing cross-site request optional

Users who have not previously registered with Simplify Commerce or users that are still in sandbox (or test) mode will be required to on-board & create a new merchant account in order to complete the oauth authorization.

In order to do so, we require personal, business and other details from the user. In order to facilitate an easier & speedier process for the user, you can optionally pass these details (urlencoded) to us and we'll pre-fill the form for them.

Show extra parameters

legalName
The name under which your business is registered with the state and on file with the IRS.
Validation: Min length: 2, Max-length: 100
optional
statementName
The name under which you do business. It's important that your customers recognize your business name on their statement.
Validation: Min length: 2, Max-length: 100
optional
businessType
The business type that describes your business. If you need more information, the IRS provides descriptions of business structures here.
Validation: Accepted values include - CCorporation, SCorporation, SoleProprietor, NotForProfit, LLC_LLP, Government
optional
businessAddress
The street address of where the business resides.
Validation: Max-length: 255
optional
businessCity
The name of the city of where the business resides.
Validation: Max-length: 255
optional
businessState
The state code of where the business resides.
Validation: This is the 2 letter code for the state e.g. CA
optional
businessZip
The ZIP code of where the business resides.
Validation: Min-length: 5, Max-Length: 9
optional
ownerAddress
The street address of where the user lives.
Validation: Max-length: 255
optional
ownerCity
The name of the city where the user lives.
Validation: Max-length: 255
optional
ownerState
The state of where the user lives.
Validation: This is the 2 letter code for the state e.g. CA
optional
ownerZip
The ZIP code of where the user lives.
Validation: Min-length: 5, Max-Length: 9
optional
stateFiling
The state where the business is incorporated.
Validation: This is the 2 letter code for the state e.g. CA
optional
url
The web site you are setting up for payments, typically your business site.
Validation: Max-length: 255, URL must include HTTP protocol e.g. http://www.simplify.com
optional
ownerFirstName
The first name of the user.
Validation: Min length: 2, Max-length: 100
optional
ownerLastName
The last name of the user.
Validation: Min length: 2, Max-length: 100
optional
phone
Phone number for the user.
Validation: Any valid US phone number
optional
mobile
Mobile number of the user.
Validation: Any valid US phone number
optional
customerServicePhone
Customers of the business will call this number if there's a question about a charge on a statement.
Validation: Any valid US phone number
optional

Simplify Commerce then authenticates the user confirming their access to the Sandbox/Live account and requested permissions.

Assuming that proper authorization is given, Simplify Commerce will redirect to the redirect url (registered with the application) with the code and state.

Below is an example URL.

https://www.simplify.com/commerce/oauth/authorize?response_type=code&scope=full&client_id=lvpb_ThisIsYourOAuthPublicKey&state=some_value

Authorization Response

If the user approves the access request, then the response will contain the authorization and the state parameter (if you sent it in the request). If the user does not grant access the request will contain an error message. The message will be sent on the response query string. Example responses are below:

Error response

https://www.yourapp.com/code?error=access_denied&error_description=User has denied the oauth authorization request&state=some_value

Authorization response

https://www.yourapp.com/code?code=LWJeou0349SLKEJr&state=some_value

Obtaining an Access Token

The client is now able to use the provided code to redeem an access token.

In the SDKs the following parameters are needed:

YOUR OAUTH PUBLIC_KEY This is the oauth public key in the app management section of Simplify Commerce. required
YOUR OAUTH PRIVATE_KEY This is the oauth private key in the app management section of Simplify Commerce. required
YOUR OAUTH REDIRECT URI This value must match the redirect uri supplied when obtaining the oauth key in the app management section of Simplify Commerce. required

Below are the SDK examples:

import com.simplify.payments.AccessToken;
import com.simplify.payments.Authentication;
import com.simplify.payments.PaymentsApi;

try{
    PaymentsApi.PUBLIC_KEY="YOUR OAUTH PUBLIC_KEY";
    PaymentsApi.PRIVATE_KEY="YOUR OAUTH PRIVATE_KEY";
    String REDIRECT_URI="YOUR OAUTH REDIRECT URI";
    AccessToken accessToken=AccessToken.create(code,REDIRECT_URI);
}
    catch(Exception ex){
    ex.printStackTrace();
}
require 'simplify'

Simplify::public_key = "YOUR OAUTH PUBLIC_KEY"
Simplify::private_key = "YOUR OAUTH PRIVATE_KEY"

CODE = 'OAUTH AUTHORIZATION CODE'
REDIRECT_URI = 'YOUR OAUTH REDIRECT URI';
token = Simplify::AccessToken.create(CODE, REDIRECT_URI)
import simplify

simplify.public_key = "YOUR OAUTH PUBLIC_KEY"
simplify.private_key = "YOUR OAUTH PRIVATE_KEY"

CODE = 'OAUTH AUTHORIZATION CODE'
REDIRECT_URI = 'YOUR OAUTH REDIRECT URI'

token = simplify.AccessToken.create(CODE, REDIRECT_URI)
<?php
    require_once("./lib/Simplify.php");

    Simplify::$publicKey = 'YOUR OAUTH PUBLIC_KEY';
    Simplify::$privateKey = 'YOUR OAUTH PRIVATE_KEY';

    $code = 'OAUTH AUTHORIZATION CODE';
    $redirect_uri = 'YOUR OAUTH REDIRECT URI';

    $accessToken = Simplify_AccessToken::create($code, $redirect_uri);
?>
use Net::Simplify;

$Net::Simplify::public_key = "YOUR OAUTH PUBLIC_KEY";
$Net::Simplify::private_key = "YOUR OAUTH PRIVATE_KEY";

$CODE = 'OAUTH AUTHORIZATION CODE';
$REDIRECT_URI = 'YOUR OAUTH REDIRECT URI';

$token = Net::Simplify::AccessToken->create($CODE, $REDIRECT_URI);
using SimplifyCommerce.Payments;
 
try
{
  PaymentsApi api = new PaymentsApi();
  PaymentsApi.PublicApiKey = "YOUR OAUTH PUBLIC_KEY";
  PaymentsApi.PrivateApiKey = "YOUR OAUTH PRIVATE_KEY";
  string code = "iBxx7c";
  OauthAccessTokenRequest req = new OauthAccessTokenRequest();
  req.RedirectUri = "YOUR OAUTH REDIRECT URI";
  req.Code = code;
  OauthAccessToken token = api.RequestAccessToken(req);
}
catch (ApiException e)
{
  Console.WriteLine("Message: " + e.Message);
}
var Simplify = require("simplify-commerce"),
    client = Simplify.getClient({
        publicKey: 'YOUR_OAUTH_PUBLIC_KEY',
        privateKey: 'YOUR_OAUTH_PRIVATE_KEY'
    });

client.accesstoken.create({
    authCode: 'OAUTH_AUTHORIZATION_CODE',
    redirectUri: 'YOUR_OAUTH_REDIRECT_URI'
}, function(errData, data){

    if(errData){
        console.error("Error Message: " + errData.data.error_description);
        // handle the error
        return;
    }

    console.log("Access Token: " + data.access_token);
    console.log("Refresh Token: " + data.refresh_token);
});

A success response will contain the access_token, when the access token expires, and the refresh token.


access_token The token that can be used with a Simplify Commerce API. Access tokens have a limited lifespan before needing to be refreshed (12 hours).
expired_in The remaining lifetime on the access token
refresh_token A token that may be used to obtain a new access token. Refresh tokens are valid for 30 days.
refresh_expires_in The remaining lifetime on the refresh token.

A success response is returned as a JSON array in accordance with the OAuth 2.0 specification. Below is an example.

{ "access_token":"WOIHJFFW(f80ijvw3wij", "expires_in":43200, "refresh_token":"WlskjweIWnffw154", "refresh_expires_id":86400 }

Using the Simplify Commerce API

After you have obtained an access token, your application can now access a Simplify Commerce API.

Below are the SDK examples:

import com.simplify.payments.AccessToken;
import com.simplify.payments.Authentication;
import com.simplify.payments.PaymentsApi;

try {
    PaymentsApi.PUBLIC_KEY = "YOUR OAUTH PUBLIC_KEY";
    PaymentsApi.PRIVATE_KEY = "YOUR OAUTH PRIVATE_KEY";
    String REDIRECT_URI = "YOUR OAUTH REDIRECT URI";
    AccessToken accessToken = AccessToken.create(code, REDIRECT_URI);
    ResourceList payments = Payment.list(new Authentication(accessToken.get("access_token")));
}
catch (Exception ex) {
    log.error(ex)
}
require 'simplify'

Simplify::public_key = "YOUR OAUTH PUBLIC_KEY"
Simplify::private_key = "YOUR OAUTH PRIVATE_KEY"

CODE = 'OAUTH AUTHORIZATION CODE'
REDIRECT_URI = 'YOUR OAUTH REDIRECT URI';

token = Simplify::AccessToken.create(CODE, REDIRECT_URI);

auth = Simplify::Authentication.new(:access_token => token['access_token'])
payments = Simplify::Payment.list(nil, auth)

puts "Total: #{payments['total']}"
payments['list'].each do |o|
    puts o.inspect
end
import simplify

simplify.public_key = "YOUR OAUTH PUBLIC_KEY"
simplify.private_key = "YOUR OAUTH PRIVATE_KEY"

CODE = 'OAUTH AUTHORIZATION CODE'
REDIRECT_URI = 'YOUR OAUTH REDIRECT URI'

token = simplify.AccessToken.create(CODE, REDIRECT_URI)

auth = simplify.Authentication(access_token = token.access_token)
payments = simplify.Payment.list(None, auth)
<?php
    require_once("./lib/Simplify.php");

    Simplify::$publicKey = 'YOUR OAUTH PUBLIC_KEY';
    Simplify::$privateKey = 'YOUR OAUTH PRIVATE_KEY';

    $code = 'OAUTH AUTHORIZATION CODE';
    $redirect_uri = 'YOUR OAUTH REDIRECT URI';

    $accessToken = Simplify_AccessToken::create($code, $redirect_uri);
    $ret = Simplify_Payment::listPayment(array("max" => 30), new Simplify_Authentication($accessToken->access_token));
?>
use Net::Simplify;

$Net::Simplify::public_key = "YOUR OAUTH PUBLIC_KEY";
$Net::Simplify::private_key = "YOUR OAUTH PRIVATE_KEY";

$CODE = 'OAUTH AUTHORIZATION CODE';
$REDIRECT_URI = 'YOUR OAUTH REDIRECT URI';

$token = Net::Simplify::AccessToken->create($CODE, $REDIRECT_URI);

$auth = Net::Simplify::Authentication->create(access_token => $token->access_token);

$payments = Net::Simplify::Payment->list({}, $auth);

print "Total: ", $payments->total, "\n";
foreach $payment ($payments->list) {
    print "payment ", $payment->{id}, "\n";
}
using SimplifyCommerce.Payments;
 
try
{
  PaymentsApi api = new PaymentsApi();
  PaymentsApi.PublicApiKey = "YOUR OAUTH PUBLIC_KEY";
  PaymentsApi.PrivateApiKey = "YOUR OAUTH PRIVATE_KEY";
  string code = "iBxx7c";
  OauthAccessTokenRequest req = new OauthAccessTokenRequest();
  req.RedirectUri = "YOUR OAUTH REDIRECT URI";
  req.Code = code;
  OauthAccessToken token = api.RequestAccessToken(req);
  ResourceList<Payment> list = (ResourceList<Payment>)api.List(typeof(Payment), null, null, 20, 0, token);
}
catch (ApiException e)
{
  Console.WriteLine("Message: " + e.Message);
}        
var Simplify = require("simplify-commerce"),
    client = Simplify.getClient({
        publicKey: 'YOUR_OAUTH_PUBLIC_KEY',
        privateKey: 'YOUR_OAUTH_PRIVATE_KEY'
    });

client.accesstoken.create({
    authCode: 'OAUTH_AUTHORIZATION_CODE',
    redirectUri: 'YOUR_OAUTH_REDIRECT_URI'
}, function(errData, data){

    if(errData){
        console.error("Error Message: " + errData.data.error_description);
        // handle the error
        return;
    }

    console.log("Access Token: " + data.access_token);

    // Get a list of payments with the access token
    client.payment.list({
        accessToken: data.access_token,
        max: 30,
        offset: 3
    }, function(paymentErrData, paymentData){

        if(paymentErrData){
            console.error("Error Message: " + paymentErrData.data.error.message);
            // handle the error
            return;
        }

        console.log("Total: " + paymentData.total);
    });

});

Using the Refresh Token

As stated earlier, a refresh token is returned along with the access token and when the access token expires. You will need to refresh the access token after the expiration time. You may obtain a new access token by sending the refresh token to Simplify Commerce

Below are the SDK examples:

import com.simplify.payments.AccessToken;
import com.simplify.payments.Authentication;
import com.simplify.payments.PaymentsApi;

try {
    PaymentsApi.PUBLIC_KEY = "YOUR OAUTH PUBLIC_KEY";
    PaymentsApi.PRIVATE_KEY = "YOUR OAUTH PRIVATE_KEY";
    String REDIRECT_URI = "YOUR OAUTH REDIRECT URI";
    AccessToken accessToken = AccessToken.create(code, REDIRECT_URI);
    accessToken = AccessToken.refreshToken();
}
catch (Exception ex) {
    log.error(ex)
}
require 'simplify'

Simplify::public_key = "YOUR OAUTH PUBLIC_KEY"
Simplify::private_key = "YOUR OAUTH PRIVATE_KEY"

CODE = 'OAUTH AUTHORIZATION CODE'
REDIRECT_URI = 'YOUR OAUTH REDIRECT URI';

token = Simplify::AccessToken.create(CODE, REDIRECT_URI);
token.refresh()
import simplify

simplify.public_key = "YOUR OAUTH PUBLIC_KEY"
simplify.private_key = "YOUR OAUTH PRIVATE_KEY"

CODE = 'OAUTH AUTHORIZATION CODE'
REDIRECT_URI = 'YOUR OAUTH REDIRECT URI'

token = simplify.AccessToken.create(CODE, REDIRECT_URI)
token.refresh()
<?php
    require_once("./lib/Simplify.php");

    Simplify::$publicKey = 'YOUR OAUTH PUBLIC_KEY';
    Simplify::$privateKey = 'YOUR OAUTH PRIVATE_KEY';

    $code = 'OAUTH AUTHORIZATION CODE';
    $redirect_uri = 'YOUR OAUTH REDIRECT URI';

    $accessToken = Simplify_AccessToken::create($code, $redirect_uri);
    $accessToken.refresh();
?>
use Net::Simplify;

$Net::Simplify::public_key = "YOUR OAUTH PUBLIC_KEY";
$Net::Simplify::private_key = "YOUR OAUTH PRIVATE_KEY";

$CODE = 'OAUTH AUTHORIZATION CODE';
$REDIRECT_URI = 'YOUR OAUTH REDIRECT URI';

$token = Net::Simplify::AccessToken->create($CODE, $REDIRECT_URI);

$token->refresh();
using SimplifyCommerce.Payments;
 
try
{
  PaymentsApi api = new PaymentsApi();
  PaymentsApi.PublicApiKey = "YOUR OAUTH PUBLIC_KEY";
  PaymentsApi.PrivateApiKey = "YOUR OAUTH PRIVATE_KEY";
  string code = "iBxx7c";
  OauthAccessTokenRequest req = new OauthAccessTokenRequest();
  req.RedirectUri = "YOUR OAUTH REDIRECT URI";
  req.Code = code;
  OauthAccessToken token = api.RequestAccessToken(req);
  token = api.RefreshAccessToken(token);
}
catch (ApiException e)
{
  Console.WriteLine("Message: " + e.Message);
}    
var Simplify = require("simplify-commerce"),
    client = Simplify.getClient({
        publicKey: 'YOUR_OAUTH_PUBLIC_KEY',
        privateKey: 'YOUR_OAUTH_PRIVATE_KEY'
    });

client.accesstoken.refresh('OAUTH_REFRESH_TOKEN', function(errData, data){

    if(errData){
        console.error("Error Message: " + errData.data.error_description);
        // handle the error
        return;
    }

    console.log("Access Token: " + data.access_token);
    console.log("Refresh Token: " + data.refresh_token);
});

Revoking a Token

When a user wants to revoke access to their application, they can do so through the apps setting in the Simplify Commerce app. In Simplify Commerce, the access token will be revoked with the corresponding refresh token

You can also revoke the token programmatically using one of Simplify Commerces SDKs.

Below are the SDK examples:

import com.simplify.payments.AccessToken;
import com.simplify.payments.Authentication;
import com.simplify.payments.PaymentsApi;

try {
    PaymentsApi.PUBLIC_KEY = "YOUR OAUTH PUBLIC_KEY";
    PaymentsApi.PRIVATE_KEY = "YOUR OAUTH PRIVATE_KEY";
    String REDIRECT_URI = "YOUR OAUTH REDIRECT URI";
    AccessToken accessToken = AccessToken.create(code, REDIRECT_URI);
    accessToken = AccessToken.revokeToken();
}
catch (Exception ex) {
    log.error(ex)
}
require 'simplify'

Simplify::public_key = "YOUR OAUTH PUBLIC_KEY"
Simplify::private_key = "YOUR OAUTH PRIVATE_KEY"

CODE = 'OAUTH AUTHORIZATION CODE'
REDIRECT_URI = 'YOUR OAUTH REDIRECT URI';

token = Simplify::AccessToken.create(CODE, REDIRECT_URI);
token.revoke()
import simplify

simplify.public_key = "YOUR OAUTH PUBLIC_KEY"
simplify.private_key = "YOUR OAUTH PRIVATE_KEY"

CODE = 'OAUTH AUTHORIZATION CODE'
REDIRECT_URI = 'YOUR OAUTH REDIRECT URI'

token = simplify.AccessToken.create(CODE, REDIRECT_URI)
token.revoke()
<?php
    require_once("./lib/Simplify.php");

    Simplify::$publicKey = 'YOUR OAUTH PUBLIC_KEY';
    Simplify::$privateKey = 'YOUR OAUTH PRIVATE_KEY';

    $code = 'OAUTH AUTHORIZATION CODE';
    $redirect_uri = 'YOUR OAUTH REDIRECT URI';

    $accessToken = Simplify_AccessToken::create($code, $redirect_uri);
    $accessToken.revoke();
?>
use Net::Simplify;

$Net::Simplify::public_key = "YOUR OAUTH PUBLIC_KEY";
$Net::Simplify::private_key = "YOUR OAUTH PRIVATE_KEY";

$CODE = 'OAUTH AUTHORIZATION CODE';
$REDIRECT_URI = 'YOUR OAUTH REDIRECT URI';

$token = Net::Simplify::AccessToken->create($CODE, $REDIRECT_URI);

$token->revoke();
using SimplifyCommerce.Payments;
 
try
{
  PaymentsApi api = new PaymentsApi();
  PaymentsApi.PublicApiKey = "YOUR OAUTH PUBLIC_KEY";
  PaymentsApi.PrivateApiKey = "YOUR OAUTH PRIVATE_KEY";
  string code = "iBxx7c";
  OauthAccessTokenRequest req = new OauthAccessTokenRequest();
  req.RedirectUri = "YOUR OAUTH REDIRECT URI";
  req.Code = code;
  OauthAccessToken token = api.RequestAccessToken(req);
  token = api.RevokeAccessToken(token);
}
catch (ApiException e)
{
  Console.WriteLine("Message: " + e.Message);
}  
var Simplify = require("simplify-commerce"),
    client = Simplify.getClient({
        publicKey: 'YOUR_OAUTH_PUBLIC_KEY',
        privateKey: 'YOUR_OAUTH_PRIVATE_KEY'
    });

client.accesstoken.revoke('OAUTH_ACCESS_TOKEN', function(errData, data){

    if(errData){
        console.error("Error Message: " + errData.data.error_description);
        // handle the error
        return;
    }

    console.log("Revoked Token: " + data.token_revoked);
});

Create a Payment With Simplify Link

Now lets put it all together. Below are examples using the Simplify Commerce SDKs to create a payment using Simplify Link. The examples assume you have already created your OAuth keys in the app management screen of Simplify Commerce and you have obtained an authorization code

PaymentsApi.PUBLIC_KEY = "YOUR OAUTH PUBLIC_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR OAUTH PRIVATE_KEY";
String REDIRECT_URI = "YOUR OAUTH REDIRECT URI";
AccessToken accessToken = AccessToken.create(code, REDIRECT_URI);
Payment payment = Payment.create(new PaymentsMap()
        .set("currency", "USD")
        .set("card.cvc", "123")
        .set("card.expMonth", 11)
        .set("card.expYear", 99)
        .set("card.number", "5555555555554444")
        .set("amount", 1000) // In cents e.g. $10.00
        .set("description", "prod description"),
        new Authentication(accessToken.get("access_token"));
if ("APPROVED".equals(payment.get("paymentStatus"))) {
        System.out.println("Payment approved");
}
require 'simplify'
Simplify::public_key = "YOUR OAUTH PUBLIC_KEY"
Simplify::private_key = "YOUR OAUTH PRIVATE_KEY"

CODE = 'OAUTH AUTHORIZATION CODE'
REDIRECT_URI = 'YOUR OAUTH REDIRECT URI';

token = Simplify::AccessToken.create(CODE, REDIRECT_URI);

auth = Simplify::Authentication.new(:access_token => token['access_token'])

payment = Simplify::Payment.create({
        "card" => {
            "number" => "5555555555554444",
            "expMonth" => 11,
            "expYear" => 99,
            "cvc" => "123"
        },
        "amount" => 1000,
        "currency"  => "USD",
        "description" => "Description"
}, auth)
if payment['paymentStatus'] == 'APPROVED'
    puts "Payment approved"
end
import simplify
simplify.public_key = "YOUR OAUTH PUBLIC_KEY"
simplify.private_key = "YOUR OAUTH PRIVATE_KEY"

CODE = 'OAUTH AUTHORIZATION CODE'
REDIRECT_URI = 'YOUR OAUTH REDIRECT URI'

token = simplify.AccessToken.create(CODE, REDIRECT_URI)

auth = simplify.Authentication(access_token = token.access_token)

payment = simplify.Payment.create({
       "card" : {
            "number": "5555555555554444",
            "expMonth": 11,
            "expYear": 99,
            "cvc": "123"
        },
        "amount" : 1000,
        "description" : "prod description",
        "currency" : "USD"
}, auth)
if payment.paymentStatus == 'APPROVED':
    print("Payment approved")
<?php
    require_once("./lib/Simplify.php");
    Simplify::$publicKey = 'YOUR OAUTH PUBLIC_KEY';
    Simplify::$privateKey = 'YOUR OAUTH PRIVATE_KEY';

    $code = 'OAUTH AUTHORIZATION CODE';
    $redirect_uri = 'YOUR OAUTH REDIRECT URI';

    $accessToken = Simplify_AccessToken::create($code, $redirect_uri);
   
    $payment = Simplify_Payment::createPayment(array(
           "card" => array(
               "number" => "5555555555554444",
               "expMonth" => 11,
               "expYear" => 99,
               "cvc" => "123"
           ),
           'amount' => '1000',
           'description' => 'prod description',
           'currency' => 'USD'
    ) new Simplify_Authentication($accessToken->access_token));

    if ($payment->paymentStatus == 'APPROVED') {
       echo "Payment approved\n";
    }
?>
use Net::Simplify;

$Net::Simplify::public_key = "YOUR OAUTH PUBLIC_KEY";
$Net::Simplify::private_key = "YOUR OAUTH PRIVATE_KEY";

$CODE = 'OAUTH AUTHORIZATION CODE';
$REDIRECT_URI = 'YOUR OAUTH REDIRECT URI';

$token = Net::Simplify::AccessToken->create($CODE, $REDIRECT_URI);

$auth = Net::Simplify::Authentication->create(access_token => $token->access_token);

$payment = Net::Simplify::Payment->create({
        card => {
            number => "5555555555554444",
            expMonth => 11,
            expYear => 99,
            cvc => "123"
        },
        amount => 1000,
        currency  => "USD",
        description => "Description"
}, $auth);

print "Payment status: ", $payment->{paymentStatus}, "\n";
using SimplifyCommerce.Payments;

PaymentsApi api = new PaymentsApi();
PaymentsApi.PublicApiKey = "YOUR OAUTH PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR OAUTH PRIVATE_KEY";

string code = "iBxx7c";
OauthAccessTokenRequest req = new OauthAccessTokenRequest();
req.RedirectUri = "YOUR OAUTH REDIRECT URI";
req.Code = code;
OauthAccessToken token = api.RequestAccessToken(req);

Payment payment = new Payment();
payment.Amount = 123123;
Card card = new Card();
card.Cvc = "123";
card.ExpMonth = 11;
card.ExpYear = 99;
card.Number = "5555555555554444";
payment.Card = card;
payment.Currency = "USD";
payment.Description = "payment description";

try
{
    payment = (Payment)api.Create(payment, token);
}
catch (Exception e)
{
    Console.WriteLine(e.ToString());
}
var Simplify = require("simplify-commerce"),
    client = Simplify.getClient({
        publicKey: 'YOUR_OAUTH_PUBLIC_KEY',
        privateKey: 'YOUR_OAUTH_PRIVATE_KEY'
    });

client.accesstoken.create({
    authCode: 'OAUTH_AUTHORIZATION_CODE',
    redirectUri: 'YOUR_OAUTH_REDIRECT_URI'
}, function(errData, data){

    if(errData){
        console.error("Error Message: " + errData.data.error_description);
        // handle the error
        return;
    }

    console.log("Access Token: " + data.access_token);

    // Create a payment with an access token
    client.payment.create({
        accessToken: data.access_token,
        "card" : {
            "number": "5555555555554444",
                "expMonth": 11,
                "expYear": 99,
                "cvc": "123"
        },
        "amount" : "1000",
            "description" : "prod description",
            "currency" : "USD"
    }, function(paymentErrData, paymentData){

        if(paymentErrData){
            console.error("Error Message: " + paymentErrData.data.error.message);
            // handle the error
            return;
        }

        console.log("Total: " + JSON.stringify(paymentData));
    });

});