Basic API Integration

Using the QorCommerce API is easy! Follow this step-by-step guide to setup your first payment in minutes.

High-Level Structure

To create a payment, you'll need to follow one simple step:

  1. Create the Payment Object, consisting of a merchant object, a customer object, and an amount (blue objects below). The Payment response will contain the authorization or decline.

1. Create the Payment Object

The purpose of the payment object is to facilitate a payment transaction. You could create the merchant and customer objects and inline. But we'd suggest creating the Mercahnt and Customer objects in separate API calls, as it will save you time and extra network calls.

For both objects, make sure to send a minimum of a: name, street1, city, state (only for US & CA), zip, country and email value. A shipment has many extra properties that this guide doesn't cover, but which you can find in the API docs.

curl https://api.qorcommerce.com/v2/card/  \
    -H "Authorization: QorToken <PRIVATE_TOKEN>" \
    -H "Content-Type: application/json"  \
    -d '{
       "object_purpose":"PURCHASE",
       "merchant":{
          "object_purpose":"PURCHASE",
          "name":"Mr. Hippo",
          "company":"QorPay",
          "street1":"100 Dove St.",
          "street2":"",
          "city":"San Francisco",
          "state":"CA",
          "zip":"94119",
          "country":"US",
          "phone":"+1 555 321 8888",
          "email":"support@qorcommerce.io"
       },
       "customer":{
          "object_purpose":"PURCHASE",
          "name":"Mrs. Nex",
          "company":"qorpay",
          "street1":"Casa St.",
          "street_no":"814",
          "street2":"",
          "city":"San Francisco",
          "state":"CA",
          "zip":"94105",
          "country":"US",
          "phone":"+1 555 321 8888",
          "email":"support@qorcommerce.io",
          "metadata":"Customer Invoice 123456"
       },
       "amount":"1.00",
       "reference_1":"Created on",
       "reference_2":"QorPay",
       "metadata":"Customer Invoice 123456",
       "async": false
    }'
require 'qor'

qor::api_token = '<PRIVATE_TOKEN>'

merchant = {
    :object_purpose => 'PURCHASE',
    :name => 'Nex Owner',
    :company => 'QorPay',
    :street1 => 'Dove St.',
    :street_no => '100',
    :street2 => '',
    :city => 'San Francisco',
    :state => 'CA',
    :zip => '94119',
    :country => 'US',
    :phone => '+1 555 321 8888',
    :email => 'owner@qorcommerce.io' 
}

customer = {
    :object_purpose => 'PURCHASE',
    :name => 'Mr Nex"',
    :company => '',
    :street1 => 'Park Place 1',
    :street2 => '',
    :city => 'New York',
    :state => 'NY',
    :zip => '10007',
    :country => 'US',
    :phone => '+1 555 321 8888',
    :email => 'owner@qorcommerce.io'
}

payment = qor::payment.create(
    :object_purpose => 'PURCHASE',
    :merchant => merchant,
    :customer => customer,
    :amount => amount,
    :async => false
)
import qor

qor.api_key = "<PRIVATE_TOKEN>"

merchant = {
    "object_purpose": "NEW",
    "name": "Nex Owner",
    "company": "QorPay",
    "street1": "100 Dove St.",
    "city": "San Francisco",
    "state": "CA",
    "zip": "94119",
    "country": "US",
    "phone": "+1 555 321 8888",
    "email": "owner@qorcommerce.io"
}

customer = {
    "object_purpose": "NEW",
    "name": "Mr Nex",
    "company": "",
    "street1": "Broadway 1",
    "street2": "",
    "city": "New York",
    "state": "NY",
    "zip": "10007",
    "country": "US",
    "phone": "+1 555 321 8888",
    "email": "owner@qorcommerce.io",
    "metadata": "Nex doesn't lie"
}

}

payment = qor.payment.create(
    object_purpose = 'NEW',
    merchant = merchant,
    customer = customer,
    async = False
)
require_once('lib/qorcommerce.php');
qor::setApiKey("<PRIVATE_TOKEN>");

$merchant = array(
    'object_purpose' => 'PURCHASE',
    'name' => 'Shawn Ippotle',
    'company' => 'QorPay',
    'street1' => '215 Clayton St.',
    'city' => 'San Francisco',
    'state' => 'CA',
    'zip' => '94117',
    'country' => 'US',
    'phone' => '+1 555 341 9393',
    'email' => 'owner@qorcommerce.io'
);

$customer = array(
    'object_purpose' => 'PURCHASE',
    'name' => 'Mr Hippo"',
    'company' => '',
    'street1' => 'Broadway 1',
    'street2' => '',
    'city' => 'New York',
    'state' => 'NY',
    'zip' => '10007',
    'country' => 'US',
    'phone' => '+1 555 341 9393',
    'email' => 'owner@qorcommerce.io'
);

$payment = qor_Payment::create( array(
    'object_purpose'=> 'NEW',
    'merchant'=> $merchant,
    'customer'=> $customer,
    'amount'=> $amount,
    'async'=> false
    )
);
var qor = require('qorcommerce')('<PRIVATE_TOKEN>');

var merchant  = {
    "object_purpose": "NEW",
    "name": "Shawn Ippotle",
    "company": "QorPay",
    "street1": "100 Dove St.",
    "city": "San Francisco",
    "state": "CA",
    "zip": "94119",
    "country": "US",
    "phone": "+1 555 321 8888",
    "email": "owner@qorcommerce.io",
}

var customer = {
    "object_purpose": "NEW",
    "name": "Mr Nex",
    "company": "",
    "street1": "Broadway 1",
    "street2": "",
    "city": "New York",
    "state": "NY",
    "zip": "10007",
    "country": "US",
    "phone": "+1 555 321 8888",
    "email": "owner@qorcommerce.io",
    "metadata": "Nex doesn't lie"
}

        
qor.payment.create({
    "object_purpose": "NEW",
    "merchant": merchant,
    "customer": customer,
    "amount": amount,
    "async": false
},function( err ){
    console.log( "There was an error creating payment: %s", err );
});

The API will respond with the JSON serialized Payment object:

{
    "object_state": "VALID",
    "object_status": "SUCCESS",
    "object_purpose": "PURCHASE",
    "object_created": "2013-12-01T06:24:20.121Z",
    "object_updated": "2013-12-01T06:24:20.121Z",
    "object_id": "5e40ead7cffe4cc1ad45108696162e42",
    "object_owner": "owner@qorcommerce.io",
    "merchant": "4f406a13253945a8bc8deb0f8266b245",
    "customer": "4c7185d353764d0985a6a7825aed8ffb",
    "amount": "1.00",
    "submission_date": "2013-12-03T12:00:00.000Z",
    "extra": {},
    "reference_1": "",
    "reference_2": "",
    "processor_account": "",
    "metadata": "Customer Invoice 123456",
    "messages": []
}