Getting Started
The GloballyPaid Payments API is organized around REST.
In order to get started you will need to request a Secret API Key and HMAC Encryption Key from GloballyPaid support. The secret key identifies your application to the GloballyPaid system. The HMAC Encryption Key is used for creating the required HMAC SHA 256 signature header for each request.
Example codes for configuring the SDK:
//All SDK calls can be configured within ConfigureServices method in Startup class using the AddGloballyPaid extension. Additionally, this extension call with register all Globally Paid services:
services.AddGloballyPaid("Your Publishable API Key", "Your Shared Secret", "Your APP ID", useSandbox: false, requestTimeoutSeconds: 90);
//To register the Globally Paid services only, AddGloballyPaidServices extension can be used:
services.AddGloballyPaidServices();
//All SDK calls can be configured using the static GloballyPaidConfiguration object:
GloballyPaidConfiguration.PublishableApiKey = "Your Publishable API Key";
GloballyPaidConfiguration.SharedSecret = "Your Shared Secret";
GloballyPaidConfiguration.AppId = "Your APP ID";
GloballyPaidConfiguration.UseSandbox = false; //true if you need to test through Globally Paid sandbox
GloballyPaidConfiguration.RequestTimeoutSeconds = 90;
//Or using the GloballyPaidConfiguration Setup method:
GloballyPaidConfiguration.Setup("Your Publishable API Key", "Your Shared Secret", "Your APP ID", useSandbox: false, requestTimeoutSeconds: 90);
//Additionally, all SDK service methods accept an optional RequestOptions object, additionally allowing per-request configuration:
var requestOptions = new RequestOptions("Your Publishable API Key", "Your Shared Secret", "Your APP ID", useSandbox: false, requestTimeoutSeconds: 90);
// Configure by initializing the class with Environment properties
GloballyPaid globallyPaid = new GloballyPaid(
Config.builder()
.publishableApiKey(System.getenv("PUBLISHABLE_API_KEY"))
.appId(System.getenv("APP_ID"))
.sharedSecret(System.getenv("SHARED_SECRET"))
.sandbox(System.getenv("USE_SANDBOX"))
.build());
// Or Configure by initializing the class with static values
String publishableApiKey = "pk_live_xxxxx";
String appId = "XXXXXXXX";
String sharedSecret = "XXXXXXXX";
GloballyPaid globallyPaid = new GloballyPaid(
Config.builder()
.publishableApiKey(publishableApiKey)
.appId(appId)
.sharedSecret(sharedSecret)
.build());
// Modify sandbox setting
GloballyPaid.setSandbox(true);
// Additionally, all SDK service methods accept an optional RequestOptions object
GloballyPaid.setConnectTimeout(50 * 1000); // in milliseconds
GloballyPaid.setReadTimeout(100 * 1000);
// Or using RequestOptions object
RequestOptions options = RequestOptions.builder()
.publishableApiKey("Your Publishable API Key")
.appId("Your APP ID")
.sharedSecret("Your Shared Secret")
.connectTimeout(50 * 1000) // in milliseconds
.readTimeout(100*1000)
.build();
//Needed configuration for PHP-sdk is simple and can be included anywhere depends from framework or application
//required config
$config['PublishableApiKey'] = 'PublishableApiKey_here';
$config['AppId'] = 'AppId_here';
$config['SharedSecret'] = 'SharedSecret_here';
$config['Sandbox'] = true;
//optional config
//$config['ApiVersion'] = 'v1'; //default v1
//$config['RequestTimeout'] = 10; //default 30
//set dynamic config when class is initialized
$GloballyPaid->setConfig([
'PublishableApiKey' => 'PublishableApiKey_here',
'AppId' => 'AppId_here',
'SharedSecret' => 'SharedSecret_here',
'Sandbox' => true,
'ApiVersion' => 'v1',
'RequestTimeout' => 5
]);
# Initializing the client
gateway = ActiveMerchant::Billing::GloballyPaidGateway.new(
:publishable_api_key => 'T0FL5VDNQRK0V6H1Z6S9H2WRP8VKIVWO',
:app_id => '6652820b-6a7a-4d36-bc32-786e49da1cbd',
:shared_secret => 'ME1uVox0hrk7i87e7kbvnID38aC2U3X8umPH0D+BsVA=',
:sandbox => true)
# ActiveMerchant accepts all amounts as Integer values in cents
amount = 1000 # $10.00
# The card verification value is also known as CVV2, CVC2, or CID
if credit_card.validate.empty?
# Capture $10 from the credit card
response = gateway.charge(amount, credit_card)
if response.success?
puts "Successfully charged $#{sprintf("%.2f", amount / 100)} to the credit card #{credit_card.display_number}"
else
raise StandardError, response.message
end
end
Authentication
Example code for generating the HMACSHA256 hash:
// Authentication headers are automatically set inside http client
// and this step is not required for the SDK
// Authentication headers are automatically set inside http client
// and this step is not required for the SDK
//Authentication headers are automatic inside http client and this step is not required for the PHP-sdk
# Authentication headers are automatically set inside http client
# and this step is not required for the SDK
GloballyPaid requires that all calls to the Payments API are secured with an HMAC header.
Your application is already identified by your Secret API Key. The HMAC header provides an additional layer of security by insuring that the request that you sent to the GloballyPaid API was not altered by a third party in transit.
Your application takes the request object and encrypts its JSON form using the public key of a keypair that is issued to you by GloballyPaid.
When the GloballyPaid API receives the request, it decrypts the HMAC header content using the private key from the same keypair and then compares the decypted content to the actual request object received in the request body. If the decrypted HMAC header does not match the request object the API request will be rejected with a 401 Unauthorized
.
Tokens
The Token Request Object
{
"payment_instrument": {
"type": "creditcard",
"creditcard": {
"number": "4111111111111111",
"expiration": "0123",
"cvv": "123"
},
"billing_contact": {
"first_name": "Test",
"last_name": "Tester",
"address": {
"line_1": "123 Main St",
"city": "NYC",
"state": "NY",
"postal_code": "92657",
"country": "United States"
},
"phone": "614-340-0823",
"email": "test@test.com"
}
}
}
The Token Response Object
{
"id": "tok_S_AdoYpxnkurNYEx5Xd11g",
"type": "CreditCard",
"brand": "Visa",
"last_four": "1111",
"expiration": "0123",
"billing_contact": {
"first_name": "Test",
"last_name": "Tester",
"address": {
"line_1": "123 Main St",
"line_2": null,
"city": "NYC",
"state": "NY",
"postal_code": "92657",
"country": "United States"
},
"phone": "614-340-0823",
"email": "test@test.com"
},
"created": "2020-09-18T19:45:05.7845109Z",
"updated": "2020-09-18T19:45:05.7845109Z"
}
In order to charge a credit or debit card, your application must first tokenize
the card data. Typically, this step is performed using our JS SDK. This allows you to tokenize the card data by passing it directly from the client application (a browser in most cases) to the GloballyPaid servers. GloballyPaid will securely store the card data and return a Token to your application.
After a period of time, or after the Token is used in a ChargeRequest, the Token will be automatically deleted. If you wish to store card data for future use, you must create a Customer and a PaymentInstrument associated to that Customer. For your convenience, this can be done very simply, in a single step, by configuring the ChargeRequest object.
Example code for tokenizing the card data:
var tokenizeRequest = new TokenizeRequest
{
PaymentInstrument = new PaymentInstrumentRequest
{
Type = PaymentType.CreditCard,
CreditCard = new CreditCard
{
Number = "4111111111111111",
Expiration = "0725",
Cvv = "123"
},
BillingContact = new Contact
{
FirstName = "Test",
LastName = "Tester",
Address = new Address
{
Line1 = "Address Line 1",
City = "CIty",
State = "State",
PostalCode = "00000",
Country = "Country"
},
Phone = "000-000-0000",
Email = "test@test.com"
}
}
};
//if Globally Paid services are registered, you can inject this as ITokenService in the constructor
var tokenService = new TokenService();
var token = tokenService.Tokenize(tokenizeRequest);
GloballyPaid globallyPaid =
new GloballyPaid(
Config.builder()
.publishableApiKey(System.getenv("PUBLISHABLE_API_KEY"))
.appId(System.getenv("APP_ID"))
.sharedSecret(System.getenv("SHARED_SECRET"))
.sandbox(System.getenv("USE_SANDBOX"))
.build());
Address address =
Address.builder()
.line1("Address Line 1")
.city("City")
.state("State")
.postalCode("12345")
.country("US")
.build();
BillingContact billingContact =
BillingContact.builder()
.firstName("Test")
.lastName("Tester")
.address(address)
.phone("000-000-0000")
.email("test@test.com")
.build();
CreditCard creditCard =
CreditCard.builder().number("4111111111111111").
expiration("0123").cvv("123").build();
PaymentInstrument paymentInstrument =
PaymentInstrument.builder()
.type("creditcard")
.creditCard(creditCard)
.billingContact(billingContact)
.build();
TokenRequest tokenRequest =
TokenRequest.builder().paymentInstrument(paymentInstrument).build();
PaymentInstrumentToken paymentInstrumentToken = globallyPaid.token(tokenRequest);
//Create token
$token = $GloballyPaid->token->create([
'payment_instrument' => [
'type' => 'creditcard',
'creditcard' => [
'number' => '4111111111111111',
'expiration' => '0725',
'cvv' => 123
],
'billing_contact' => [//must be array
'first_name' => 'Test',
'last_name' => 'Tester',
'address' => [
'line_1' => 'Address Line 1',
'line_2' => null,
'city' => 'City',
'state' => 'State',
'postal_code' => '00000',
'country' => 'Country'
],
'phone' => '000-000-0000',
'email' => 'email@test.com'
]
]
]);
//needed token for other requests can be used as $token->id
Customers
The Customer object
The Customer object
{
"id": "cus_AtYaPoX2UECY-37FjNRhtg",
"client_id": "1128",
"client_customer_id": "123457",
"created": "2020-04-18T01:37:09.0726458+00:00",
"updated": "2020-04-18T01:37:09.0726466+00:00",
"first_name": "Jane",
"last_name": "Doe",
"address": {
"line_1": "5555 Main St",
"line_2": null,
"city": "Anytown",
"state": "UT",
"postal_code": "12345",
"country": "US"
},
"phone": "7145551212",
"email": "jane.doe@example.com"
}
Customer objects allow you to perform recurring charges, and to track multiple charges that are associated with the same customer. The API allows you to create, delete, and update your customers. You can retrieve individual customers as well as a list of all your customers.
Create, Retrieve, Update, Delete, List Customer(s)
Creating a Customer
{
"client_customer_id": "123457",
"first_name": "Jane",
"last_name": "Doe",
"address": {
"line_1": "5555 Main St",
"line_2": null,
"city": "Anytown",
"state": "UT",
"postal_code": "12345",
"country": "US"
},
"phone": "7145551212",
"email": "jane.doe@example.com"
}
Updating a Customer
{
"id": "{{customer_id}}",
"client_customer_id": "123457",
"first_name": "Jane",
"last_name": "Test",
"address": {
"line_1": "5555 Main St",
"line_2": null,
"city": "Anytown",
"state": "UT",
"postal_code": "12345",
"country": "US"
},
"phone": "7145551212",
"email": "jane.test@example.com"
}
The Customers API allows you to create, update, retrieve, delete, and list all of your Customers.
You retrieve a specific customer with a simple GET request:
https://transactions.globallypaid.com/api/v1/customer/{id}
You can list all of your customers by ommitting the customer ID paramenter in the URL:
https://transactions.globallypaid.com/api/v1/customer/
Example code for creating customer:
//if Globally Paid services are registered, you can inject this as ICustomerService in the constructor
var customerService = new CustomerService();
var customer = customerService.Create(new Customer
{
ClientCustomerId = "0000000",
FirstName = "Jane",
LastName = "Doe",
Address = new Address
{
Line1 = "Address Line 1",
City = "CIty",
State = "State",
PostalCode = "00000",
Country = "Country"
},
Email = "jane.doe@example.com",
Phone = "0000000000"
});
Customer customer =
new Customer(
Config.builder()
.publishableApiKey(System.getenv("PUBLISHABLE_API_KEY"))
.appId(System.getenv("APP_ID"))
.sharedSecret(System.getenv("SHARED_SECRET"))
.sandbox(System.getenv("USE_SANDBOX"))
.build());
Address address =
Address.builder()
.line1("Address Line 1")
.city("City")
.state("State")
.postalCode("12345")
.country("US")
.build();
Customer createdCustomer =
Customer.builder()
.clientCustomerId("0000000")
.firstName("Jane")
.lastName("Doe")
.address(address)
.phone("000-000-0000")
.email("jane.doe@example.com")
.build()
.create();
//create new customer
$newCustomer = $GloballyPaid->customers->create([
'client_customer_id' => 'client_customer_id_here',
'first_name' => 'Jane',
'last_name' => 'Doe',
'address' => [
'line_1' => 'Address Line 1',
'line_2' => null,
'city' => 'City',
'state' => 'State',
'postal_code' => '00000',
'country' => 'Country'
],
'phone' => '0000000000',
'email' => 'jane.doe@example.com'
]);
Example code for retrieving customer:
//if Globally Paid services are registered, you can inject this as ICustomerService in the constructor
var customerService = new CustomerService();
var customer = customerService.Get("customer_id");
Customer customer =
new Customer(
Config.builder()
.publishableApiKey(System.getenv("PUBLISHABLE_API_KEY"))
.appId(System.getenv("APP_ID"))
.sharedSecret(System.getenv("SHARED_SECRET"))
.sandbox(System.getenv("USE_SANDBOX"))
.build());
Customer retrievedCustomer = customer.retrieve("customer_id_here");
//retrieving existing customer by id
$existingCustomer = $GloballyPaid->customers->get('customer_id_here');
//or
$existingCustomer = $GloballyPaid->customers->retrieve('customer_id_here');
Example code for updating customer:
//if Globally Paid services are registered, you can inject this as ICustomerService in the constructor
var customerService = new CustomerService();
var customer = customerService.Get("customer_id");
customer.LastName = "Smith";
customer = customerService.Update(customer);
Customer customer = Customer.builder().build().retrieve("customer_id_here");
customer.setLastName("Smith");
Customer updatedCustomer = customer.update(customer.getId());
//update existing customer
$updateExistingCustomer = $GloballyPaid->customers->update('customer_id_here',
[
'first_name' => 'New name',
'last_name' => 'Smith',
'address' => [
'line_1' => 'New address',
],
'email' => 'newemail@example123.com'
]
);
Example code for deleting customer:
//if Globally Paid services are registered, you can inject this as ICustomerService in the constructor
var customerService = new CustomerService();
customerService.Delete("customer_id");
Customer.builder().build().delete("customer_id_here");
//delete existing customer by id
$response = $GloballyPaid->customers->delete('customer_id_here');
Example code for listing all customers:
//if Globally Paid services are registered, you can inject this as ICustomerService in the constructor
var customerService = new CustomerService();
var customers = customerService.List();
List<Customer> customers = Customer.builder().build().list();
//get all customers
$customers = $GloballyPaid->customers->all();
//do anything with $customers list here
//example
foreach($customers as $customer){
//handle each $customer here
}
Payment Instruments
In most cases, integrated applications will include a backend service that stores information about the application's users and their payment methods. This allows the application to expose user interfaces where the user can add / edit / delete their cards on file, and maintain their user profile.
The Payment Instrument object
The GloballyPaid vault allows storing of complete cardholder information, including name and billing address (used for AVS checks).
You can build a fully functional page for your users to maintain their cards on file without storing any data in your application other than the GloballyPaid Customer ID.
The Payment Instrument object
{
"id": "card_r6Wt3zkWTkK3CtM32Y_lTw",
"type": "CreditCard",
"customer_id": "cus_AtYaPoX2UECY-37FjNRhtg",
"client_customer_id": "123457",
"brand": "Visa",
"last_four": "1111",
"expiration": "0725",
"billing_contact": {
"first_name": "Test",
"last_name": "Tester",
"address": {
"line_1": "Address Line 1",
"line_2": null,
"city": "city",
"state": "state",
"postal_code": "00000",
"country": "country"
},
"phone": "000-000-0000",
"email": "test@test.com"
},
"created": "2020-09-10T14:53:21.668+00:00",
"updated": "2020-09-10T14:53:21.668+00:00"
}
Maintaining Payment Instruments in the Vault
You may want to use the GloballyPaid vault is the "single source of truth" in your application, rather than trying to keep cardholder profile data in sync between the GloballyPaid vault and your backend system.
Create, Retrieve, Update, Delete, List Payment Instrument(s)
The GloballyPaid API provides methods to create, retrieve, update, delete, and list PaymentInstruments by customer ID.
Example code for creating payment instrument:
//if Globally Paid services are registered, you can inject this as IPaymentInstrumentService in the constructor
var paymentInstrumentService = new PaymentInstrumentService();
var paymentInstrument = paymentInstrumentService.Create("41111111111111", "123", new PaymentInstrument
{
Type = PaymentType.CreditCard,
CustomerId = customerForPaymentInstrument.Id,
ClientCustomerId = "123457",
Brand = "Visa",
Expiration = "0725",
LastFour = "1111",
BillingContact = new Contact
{
FirstName = "Jane",
LastName = "Doe",
Address = new Address
{
Line1 = "Address Line 1",
City = "CIty",
State = "State",
PostalCode = "00000",
Country = "Country"
},
Email = "jane.doe@example.com",
Phone = "0000000000"
}
});
Address address =
Address.builder()
.line1("Address Line 1")
.city("City")
.state("State")
.postalCode("12345")
.country("US")
.build();
BillingContact billingContact =
BillingContact.builder()
.firstName("Test")
.lastName("Tester")
.address(address)
.phone("000-000-0000")
.email("test@test.com")
.build();
CreditCard creditCard =
CreditCard.builder().number("4111111111111111").
expiration("0123").cvv("123").build();
PaymentInstrumentToken paymentInstrumentToken =
PaymentInstrument.builder()
.type("creditcard")
.creditCard(creditCard)
.customerId("customer_id_here")
.clientCustomerId("customer_id_from_your_system")
.billingContact(billingContact)
.build()
.create();
//create payemnt instrument
$newPaymentInstrument = $GloballyPaid->paymentinstrument->create([
'customer_id' => 'existing_customer_id_here',
'client_customer_id' => 'customer_id_from_your_system',
'type' => 'creditcard',
'creditcard' => [
'number' => '4111111111111111',
'expiration' => '0627',
'cvv' => 361
],
'billing_contact' => [
'first_name' => 'Test',
'last_name' => 'Tester',
'address' => [
'line_1' => 'Address line 1',
'line_2' => null,
'city' => 'City',
'state' => 'State',
'postal_code' => '00000',
'country' => 'Country'
],
'phone' => '000-000-000',
'email' => 'email@test.com'
]
]);
Example code for retrieving payment instrument:
//if Globally Paid services are registered, you can inject this as IPaymentInstrumentService in the constructor
var paymentInstrumentService = new PaymentInstrumentService();
var paymentInstrument = paymentInstrumentService.Get("payment_instrument_id");
PaymentInstrumentToken paymentInstrumentToken =
PaymentInstrument.builder().build().retrieve("payment_instrument_id_here");
//get existing paymentinstrument by id
$singlePaymentInstrument = $GloballyPaid->paymentinstrument->get('paymentinstrument_id_here');
//or
$singlePaymentInstrument = $GloballyPaid->paymentinstrument->retrieve('paymentinstrument_id_here');
Example code for updating payment instrument:
//if Globally Paid services are registered, you can inject this as IPaymentInstrumentService in the constructor
var paymentInstrumentService = new PaymentInstrumentService();
var paymentInstrument = paymentInstrumentService.Get("payment_instrument_id");
paymentInstrument.BillingContact.LastName = "Smith";
paymentInstrument = paymentInstrument.Update("41111111111111", "123", paymentInstrument)
PaymentInstrumentToken paymentInstrumentToken =
PaymentInstrument.builder().build().retrieve("payment_instrument_id_here");
PaymentInstrumentToken updatedPaymentInstrumentToken =
PaymentInstrument.builder()
.id(retrievedPaymentInstrument.getId())
.clientCustomerId(retrievedPaymentInstrument.getClientCustomerId())
.type(retrievedPaymentInstrument.getType())
.customerId("123456")
.billingContact(retrievedPaymentInstrument.getBillingContact())
.clientId(retrievedPaymentInstrument.getClientId())
.build()
.update(retrievedPaymentInstrument.getId());
//update existing paymentinstrument by id
$updatePaymentInstrument = $GloballyPaid->paymentinstrument->update('paymentinstrument_id_here',
[
'customer_id' => 'customer_id_here',
'billing_contact' =>
[
'first_name' => 'John',
'last_name' => 'Doe',
'address' =>
[
'line_1' => 'New address'
],
'phone' => '2125551212',
'email' => 'jdoe@example.com',
],
]);
Example code for deleting payment instrument:
//if Globally Paid services are registered, you can inject this as IPaymentInstrumentService in the constructor
var paymentInstrumentService = new PaymentInstrumentService();
paymentInstrumentService.Delete("payment_instrument_id");
PaymentInstrument.builder().build().delete("payment_instrument_id_here");
//delete existing paymentinstrument by id
$deleteResponse = $GloballyPaid->paymentinstrument->delete('paymentinstrument_id_here');
Example code for listing all payment instruments:
//if Globally Paid services are registered, you can inject this as IPaymentInstrumentService in the constructor
var paymentInstrumentService = new PaymentInstrumentService();
var paymentInstruments = paymentInstrumentService.List("customer_id");
List<PaymentInstrumentToken> retrievedPaymentInstruments =
PaymentInstrument.builder().build().list("customer_id_here");
//get all payment instruments
$paymentInstruments = $GloballyPaid->paymentinstrument->all('customer_id_here');
//do anything with $paymentInstruments list here
//example
foreach ($paymentInstruments as $paymentInstrument) {
//handle each $paymentInstrument here
}
Processing Payments
The Charge Request Object
{
"client_customer_id": null,
"amount": 1299,
"fees": [
{
"fee_type": "C001",
"description": "Convenience Fee",
"amount": "399"
}
],
"capture": true,
"recurring": false,
"currency_code": "USD",
"country_code": "US",
"client_transaction_id": "154896575",
"client_transaction_description": "Burger Joint",
"client_invoice_id": "758496",
"avs": true,
"source": "tok_S_AdoYpxnkurNYEx5Xd11g",
"shipping_info": null,
"session_id": "c8960e54409ae096793b15f027afd8d7",
"user_agent": null,
"browser_header": null,
"save_payment_instrument": false
}
Once you have retrieved a Token, you can create a ChargeRequest object in order to charge the credit or debit card. In response, you will receive a ChargeResponse object. All of your original request data will be echoed in the response along with other important information about the result.
The Charge Request
Parameter | Type | Description |
---|---|---|
client_customer_id | string | A unique identifier for the person in the Companyās system. |
amount | integer | A non-negative integer representing the smallest unit of the specified currency (example; 499 = $4.99 in USD) |
fees [...] | A list of FeeItems | Fee Items allow you to specify individual fees that can be exposed in reporting for your accounting purposes |
capture | boolean | When set to true (default), the charge will be immediately captured against the payment method specified. When set to false, performs an authorization only and must be captured explicitly later. |
recurring | boolean | Specifies whether the transaction is a recurring charge (eg: subscription, auto-ship, etc) or not. Setting this property properly positively affects authorization rates. |
currency_code | string | The ISO currency code for this charge request. (eg: USD) |
country_code | string | The two character country code for this charge (eg: US) |
client_transaction_id | string | A unique identifier for the transaction in the Companyās system. |
client_transaction_description | string | A short description for this charge |
client_invoice_id | string | The Companyās invoice number/id for this charge |
avs | boolean | The AVS setting should almost always be true (default) |
source | string | The ID of the payment method to be charged |
shipping_info | ShippingContact | An object of type ShippingContact |
session_id | string | The Kount device session Id used for Kount Fraud Checks. Must be enabled in Company configuration |
user_agent | string | The user-agent string of the browser requesting the charge. Used for enhanced fraud checks. |
browser_header | string | The browser header. Used for enhanced fraud checks. |
save_payment_instrument | boolean | When 'true', GloballyPaid will save the card data for future use and return a PaymentInstrument ID in the response |
cof_type | string | UNSCHEDULED_CARDHOLDER Ex: typical user initiated transaction on a payment page UNSCHEDULED_MERCHANT Ex: tollway refilling your account balance RECURRING Ex: subscription service INSTALLMENT Ex: buying an exercise bike for "three low monthly payments of just $299.99" |
The Charge Response
The Charge Response Object
{
"id": "ch_qCJ6ge7PRkivHMHYovRpyg",
"response_code": "00",
"message": "Approved",
"approved": true,
"source": {
"id": "tok_S_AdoYpxnkurNYEx5Xd11g",
"type": "CreditCard",
"brand": "Visa",
"last_four": null,
"expiration": "0627",
"billing_contact": {
"first_name": "Test",
"last_name": "Tester",
"address": {
"line_1": "123 Main St",
"line_2": null,
"city": "NYC",
"state": "NY",
"postal_code": "92657",
"country": "United States"
},
"phone": "614-340-0823",
"email": "test@test.com"
},
"created": "2020-09-18T19:45:05.784+00:00",
"updated": "2020-09-18T19:45:05.784+00:00"
},
"amount": 10,
"captured": true,
"recurring": false,
"currency_code": "USD",
"country_code": "US",
"billing_info": {
"first_name": "Test",
"last_name": "Tester",
"address": {
"line_1": "123 Main St",
"line_2": null,
"city": "NYC",
"state": "NY",
"postal_code": "92657",
"country": "United States"
},
"phone": "614-340-0823",
"email": "test@test.com"
},
"client_transaction_id": "154896575",
"client_transaction_description": "ChargeWithToken",
"client_invoice_id": "758496",
"save_payment_instrument": true,
"new_payment_instrument": {
"id": "card_AAabOY3elk6mU6eOHLCrXQ",
"type": "CreditCard",
"brand": "Visa",
"last_four": "7117",
"expiration": "0627",
"billing_contact": {
"first_name": "Test",
"last_name": "Tester",
"address": {
"line_1": "123 Main St",
"line_2": null,
"city": "NYC",
"state": "NY",
"postal_code": "92657",
"country": "United States"
},
"phone": "614-340-0823",
"email": "test@test.com"
},
"created": "2020-09-18T20:00:49.9692404Z",
"updated": "2020-09-18T20:00:49.9692404Z"
},
"kount_score": null,
"completed": "2020-09-18T20:00:50.0167285Z"
}
The ChargeResponse object provides a number of important pieces of information.
- The ID should be stored by your application along with your system's order or invoice ID so that you can refund it later if necessary.
- The response code attribute indicates success, failure, or error states.
- For convenience, the
approved
attribute is a simple boolean indicator of whether or not the transaction was approved. Afalse
value could indicate either a decline or an error. - The
new_payment_instrument
attribute will contain information about the PaymentInstrument that was created from the submitted Token if thesave_payment_instrument
parameter was set totrue
. You will want to store the ID of the PaymentInstrument along with your customer data for future charges (recurring billing).
Parameter | Type | Description |
---|---|---|
id | string | The ID of the Charge object |
response_code | string | Indicates the success or failure of the transaction |
message | string | Details about the result of the transaction |
approved | boolean | Convenience attribute. Indicates approved / declined. |
approval_code | string | |
cvv_result | string | The result of the CVV check, if one was performed |
avs_result | string | The result of the AVS check, if one was performed |
source | PaymentInstrumentToken | The original Token that was used for the transaction |
amount | integer($int32) | The Amount that was charged to the PaymentInstrument |
fees | A list of Fee objects | For convenience in certain types of billing |
captured | boolean | Indicates whether or not the Charge was captured. The ChargeRequest capture parameter defaults to true . This value will normally be true unless the Charge was declined. |
recurring | boolean | Echoed from ChargeRequest |
currency_code | string | Echoed from ChargeRequest |
country_code | string | Echoed from ChargeRequest |
billing_info | BillingContact{...} | Echoed from ChargeRequest |
shipping_info | ShippingContact{...} | Echoed from ChargeRequest |
client_transaction_id | string | Echoed from ChargeRequest |
client_transaction_description | string | Echoed from ChargeRequest |
client_invoice_id | string | Echoed from ChargeRequest |
save_payment_instrument | boolean | Echoed from ChargeRequest |
new_payment_instrument | PaymentInstrument | If a PaymentInstrument was created, per the save_payment_instrument parameter, it will be returned here so that your application can store it. |
completed | datetime | A timestamp indicating the time that the Charge object was created. |
Optimizing Authorizations
Increased authorizations means increased sales, and avoiding fraud helps keep your business's money where it belongs. There are a few things that you can do when integrating to help with both objectives.
- Always pass as much information as you can in the Customer and PaymentMethod objects. For user attended transactions (meaning your user is actually typing in their payment method data), always include the CVV.Increased
- Including complete billing address information also improves authorizations.
- If the transaction is a recurring charge (typically requested by an automated billing system), make sure to include and set the
recurring
parameter totrue
. GloballyPaid will look up the original transaction and pass additional information to the card networks that helps improve authorization rates.
Response Codes
Code | Description |
---|---|
00 | Transaction was Approved |
200 | Declined or blocked - Call your card bank |
201 | Do not honor - Call your card bank |
202 | Insufficient Funds |
203 | Over Limit |
204 | Transaction not allowed |
220 | Invalid payment type or data |
221 | No such card issuer |
222 | No card number on file with issuer |
223 | Expired card |
224 | Invalid expired date |
225 | Invalid card security code |
240 | Call issuer for further information |
250 | Pick up Lost or Stolen card |
251 | Lost or Stolen card |
252 | Stolen card |
253 | Fraudulent card |
260 | Declined with further information available |
261 | Declined - Stop all recurring payment |
262 | Declined - Stop this recurring program |
263 | Declined - Update cardholder data available |
264 | Declined - Retry in few days |
300 | Rejected |
400 | Transaction error returned by processor |
410 | Invalid merchant configuration |
411 | Merchant account is inactive |
420 | Communication error |
421 | Communication error with issuer |
430 | Duplicate at issuer or processor |
440 | Processor format error |
441 | Invalid transaction info or card number |
460 | Processor feature not available |
461 | Unsupported card type |
24 | Decline Test Card |
500 | Unknown Processor Response |
Charge Sale Transaction
Set the capture
parameter to true
in order to immideatelly capture the charge.
Example code for charge sale transaction:
var request = new ChargeRequest
{
Source = "source", //this can be the token or payment instrument identifier
Amount = 1299,
Capture = true, //sale charge
ClientCustomerId = "12345", //set your customer id
ClientInvoiceId = "IX213", //set your invoice id
ClientTransactionDescription = "Tuition for CS" //set your transaction description
};
//if Globally Paid services are registered, you can inject this as IChargeService in the constructor
var chargeService = new ChargeService();
var charge = chargeService.Charge(request);
ChargeRequest chargeRequest =
ChargeRequest.builder()
.source("token or payment instrument identifier")
.amount(130)
.currencyCode("USD")
.clientCustomerId("12345")
.clientInvoiceId("IX213")
.clientTransactionId("154896575")
.clientTransactionDescription("Charge Transaction")
.capture(true)
.savePaymentInstrument(false)
.build();
ChargeResponse chargeResponse = GloballyPaid.builder().build().charge(chargeRequest);
//Create charge request
$charge = $GloballyPaid->charges->create([
'amount' => 9.79 * 100, //amount with cents ex. 9.79 USD should be 9.79*100
'currency' => 'usd',
'source' => 'token_id_here',
'metadata' =>
[
'client_customer_id' => '000000'
]
]);
Charge Authorization Transaction
Set the capture
parameter to false
to perform authorization only that must be captured explicitly later.
Example code for charge authorization transaction:
var request = new ChargeRequest
{
Source = "source", //this can be the token or payment instrument identifier
Amount = 1299,
Capture = false, //authorization charge
ClientCustomerId = "12345", //set your customer id
ClientInvoiceId = "IX213", //set your invoice id
ClientTransactionDescription = "Tuition for CS" //set your transaction description
};
//if Globally Paid services are registered, you can inject this as IChargeService in the constructor
var chargeService = new ChargeService();
var charge = chargeService.Charge(request);
var captureRequest = new CaptureRequest
{
Charge = charge.Id,
Amount = charge.Amount
};
//if Globally Paid services are registered, you can inject this as ICaptureService in the constructor
var captureService = new CaptureService();
var capture = captureService.Capture(captureRequest);
ChargeRequest chargeRequest =
ChargeRequest.builder()
.source("token or payment instrument identifier")
.amount(130)
.currencyCode("USD")
.clientCustomerId("12345")
.clientInvoiceId("IX213")
.clientTransactionId("154896575")
.clientTransactionDescription("Charge Transaction")
.capture(false)
.savePaymentInstrument(false)
.build();
ChargeResponse chargeResponse = GloballyPaid.builder().build().charge(chargeRequest);
CaptureResponse captureResponse =
GloballyPaid.builder().build()
.capture(
CaptureRequest.builder()
.charge(chargeResponse.getId())
.amount(chargeResponse.getAmount())
.build());
//charge request
$charge = $GloballyPaid->charges->create([
'amount' => 20*100,
'currency' => 'usd',
'source' => 'token_id_here',
'capture' => false,
'metadata' => ['client_customer_id' => '000000']
]);
//handle charge errors
if (!$charge) {
echo '<pre>' . print_r($GloballyPaid->errors(), true) . '</pre>';
}
//capture request
$capture = $GloballyPaid->charges->capture(
$charge->id,
$charge->amount
);
Converting Tokens to Permanent Payment Instruments
Set the save_payment_instrument
parameter to true
in order to convert the Token object into a PaymentInstrument automatically after the authorization is approved.
You will want to store the payment instrument ID that is returned in the response in your applications database for future use with Card On File charges.
Example code for converting to permanent payment instruments:
var request = new ChargeRequest
{
Source = "source", //this can be the token or payment instrument identifier
Amount = 1299,
ClientCustomerId = "12345", //set your customer id
ClientInvoiceId = "IX213", //set your invoice id
ClientTransactionDescription = "Tuition for CS", //set your transaction description
SavePaymentInstrument = true //sale charge (capture is true by default) and permament save of the payment instrument
};
//if Globally Paid services are registered, you can inject this as IChargeService in the constructor
var chargeService = new ChargeService();
var charge = chargeService.Charge(request);
ChargeRequest chargeRequest =
ChargeRequest.builder()
.source("token or payment instrument identifier")
.amount(130)
.currencyCode("USD")
.clientCustomerId("12345")
.clientInvoiceId("IX213")
.clientTransactionId("154896575")
.clientTransactionDescription("Charge Transaction")
.capture(true)
.savePaymentInstrument(true)
.build();
ChargeResponse chargeResponse = GloballyPaid.builder().build().charge(chargeRequest);
//charge request
$charge = $GloballyPaid->charges->create([
'amount' => 20*100,
'currency' => 'usd',
'source' => 'token_id_here',
'metadata' => ['client_customer_id' => '000000'],
'save_payment_instrument' => true //sale charge (capture is true by default) and permanent save of the payment instrument
]);
Refunds
The Refund Request Object
To refund a payment via the API, create a Refund and provide the ID of the charge to be refunded. You can also optionally refund part of a charge by specifying an amount.
The Refund Request Object
{
"amount": 1299,
"charge": "ch_klajsdi81273hjqwde98123iu",
"reason": null
}
The Refund Response Object
There is no need to track the captured or settled status of transactions in your system. GloballyPaid keeps track of the transaction's status and will perform a void when necessary.
The Refund Response Object
{
"id": "rf_8lUK0OGWBUia9IOufx_8Zw",
"response_code": "00",
"message": "SUCCESS",
"approved": false,
"charge_transaction_id": "ch_6fLlcIGgBEqphj6kjVcuYg",
"amount": 1999,
"success": true,
"completed": "2020-11-18T06:54:39.4358411Z"
}
Refund of charge
You can perform refunds with the API or through the Dashboard.
Example code for refund of charge:
var request = new ChargeRequest
{
Source = "source", //this can be the token or payment instrument identifier
Amount = 1299,
ClientCustomerId = "12345", //set your customer id
ClientInvoiceId = "IX213", //set your invoice id
ClientTransactionDescription = "Tuition for CS", //set your transaction description
};
//if Globally Paid services are registered, you can inject this as IChargeService in the constructor
var chargeService = new ChargeService();
var charge = chargeService.Charge(request);
var refundRequest = new RefundRequest
{
Charge = charge.Id,
Amount = charge.Amount
};
//if Globally Paid services are registered, you can inject this as IRefundService in the constructor
var refundService = new RefundService();
var refund = refundService.Refund(refundRequest);
ChargeRequest chargeRequest =
ChargeRequest.builder()
.source("token or payment instrument identifier")
.amount(130)
.currencyCode("USD")
.clientCustomerId("12345")
.clientInvoiceId("IX213")
.clientTransactionId("154896575")
.clientTransactionDescription("Charge Transaction")
.capture(true)
.savePaymentInstrument(false)
.build();
ChargeResponse chargeResponse = GloballyPaid.builder().build().charge(chargeRequest);
RefundResponse refundResponse =
GloballyPaid.builder().build()
.refund(
RefundRequest.builder()
.charge(chargeResponse.getId())
.amount(chargeResponse.getAmount())
.build());
//create refund request
$refund = $GloballyPaid->charges->refund(
'charge_id_here',
20 * 100 // amount
);
Payment Methods
The PaymentMethod Object
{
"id": "card_oozilotWwkCR88ufcWtTdA",
"type": "CreditCard",
"last_four": "6543",
"expiration": "0422",
"kount_session_id": null,
"billing_contact": {
"first_name": "John",
"last_name": "Doe",
"address": {
"line_1": "123 Any St",
"line_2": "Apt 23",
"city": "Anytown",
"state": "OH",
"postal_code": "32453",
"country": "US"
},
"phone": "2125551212",
"email": "jdoe@example.com"
},
"created": "2020-04-18T01:37:09.0762289+00:00",
"updated": "2020-04-18T01:37:09.0762296+00:00"
}
The PaymentMethod object represents your customer's payment instruments. They can be used with ChargeRequests to collect payments or saved to Customer objects to store instrument details for future payments.
In order to protect your business from PCI Compliance issues, PaymentMethods are created from Tokens rather than directly. Your application should never pass unencrypted cardholder data from a browser or mobile application to your servers. Instead, use the GloballyPaid API to create a Token first, by passing the cardholder data directly from the application to the GloballyPaid servers. Then create a PaymentMethod through one of two methods:
- Pass the PaymentMethod data in a ChargeRequest and set the
save_payment_instrument
parameter totrue
. - Create a PaymentMethod directly via API, by calling the
Create
endpoint and passing a valid customer ID as well as the token ID. This will create the PaymentMethod and associate it to the Customer.
Errors
The GloballyPaid API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The endpoint requested is hidden for administrators only. |
404 | Not Found -- The specified endpoint could not be found. |
405 | Method Not Allowed -- You tried to access a request with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
410 | Gone -- The endpoint requested has been removed from our servers. |
429 | Too Many Requests -- Your application is making too many requests! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |
JS SDK
Installation
Installation
npm install @globallypaid/js-sdk --save
yarn install @globallypaid/js-sdk
<script src="https://unpkg.com/@globallypaid/js-sdk@latest"></script>
You can install SDK using NPM, Yarn or with a script tag.
Note that if you use pre-defined forms they are injected as an iframe. So please be sure to check your CSP (Content Security Policy)
Initialization
Include the Globallypaid.js script on checkout page of your siteāit should preferably be loaded directly from unpkg.com, rather than included in a bundle or hosted yourself.
Using Globallypaid.js as a module
We also provide an NPM package that makes it easier to load and use Globallypaid SDK as a module.
Facade class for Globallypaid SDK is GloballyPaidSDK(publishableKey)
We also support the first version (GPG). The facade class is GPGSDK(publishableKey)
.
All the facade methods are the same in both v1 and v2 facades.
Initialize API (V2)
import { GloballyPaidSDK } from '@globallypaid/js-sdk';
const gpg = new GloballyPaidSDK('pk_live_...');
Initialize API (V1)
import { GPGSDK } from '@globallypaid/js-sdk';
const gpg = new GPGSDK('pk_live_...');
Globallypaid Forms
Globallypaid Forms are customizable UI components used to collect sensitive information in your payment forms.
Create UI form instance
gpg.createForm(type, options?)
const cardForm = gpg.createForm('card-simple');
This method creates an instance of a specific Form. It takes the type of Form to create as well as an options object.
Parameter | Type | Description |
---|---|---|
type | FormType | The UI form type to display |
options? | FrameOptions | A set of options to configure the UI Form |
Form types:
Type | Description |
---|---|
card-simple | Simple card with card number, cvv, expiration date and postal code |
card-extended | Extended card with user personal and card information |
Form with options example
const cardSimpleCustomized = gpg.createForm('card-simple', {
style: {
base: {
width: '560px',
buttonColor: 'white',
buttonBackground: '#558b2f',
inputColor: '#558b2f',
color: '#558b2f'
}
}
});
Available options:
Option | Type | Description |
---|---|---|
style | FrameStyle | Add custom user styling |
common | FrameCommonOptions | Common form configurations |
FrameStyle type:
Option | Type | Description |
---|---|---|
base | object | Base styling |
invalid | object | Invalid form styling |
Base type:
Option | Type | Example | Description |
---|---|---|---|
width | string | '500px' | The width of a form (100% by default) |
height | string | '500px' | The height of a form (100% by default) |
fontFamily | string | 'Roboto, sans-serif' | Font family of a form (Roboto by default) |
fontSize | string | '16px' | Font size of a form |
inputColor | string | '#000' | Input element color |
color | string | '#fff' | Form field labels color |
border | string | '1px solid green' | Sets frame border |
background | string | '#fafafa' | Frame background (transparent by default) |
buttonBackground | string | '#fefefe' | Submit button background |
buttonColor | string | '#ffffff' | Submit button text color |
labelsColor | string | '#ffffff' | Labels color (not related to a form fields) |
linksColor | string | '#ffffff' | Links color |
headerAndBorderBackgroundColor | string | '#ffffff' | Header and frame border color (if OneClick is enabled) |
headerBackColor | string | '#ffffff' | Back link color |
headerLabelColor | string | '#ffffff' | Label color in a header |
Invalid type:
Option | Type | Example | Description |
---|---|---|---|
color | string | '#fefefe' | Error messages text and input border color |
FrameCommonOptions
Option | Type | Example | Description |
---|---|---|---|
preventImmediateSubmit | boolean | true | Prevents immediate form submit when 'Submit' button is clicked |
Mount form to a DOM node
form.mount(nodeId)
page.html
<div id="gpg-form-container"></div>
script.js
const cardSimple = gpg.createForm('card-simple');
cardSimple.mount('gpg-form-container');
Parameter | Type | Description |
---|---|---|
nodeId | string | The id of a container where your Form will be mounted. |
The mount(nodeId)
method attaches your Form to the DOM. Method accepts the id of an element (e.g., 'gpg-form-container);
You need to create a container DOM element to mount a Form.
Form events
The only way to communicate with your Form
is by listening to an event. Forms might emit any of the events below. All events have a payload object that has it's own type.
form.on(eventType, callback, errorCallback?)
Subscribe to form response event
cardSimple.on('FORM_RESPONSE',
(response) => {
console.log(response);
// Do whatever you need with the response.
// Send a request to yours backend to perform a charge request
},
(error) => {
cardSimple.showError(error.message);
}
);
Parameter | Type | Description |
---|---|---|
eventType | string | The name of the event. In this case, 'FORM_RESPONSE' |
callback | function | A callback function that you provide that will be called when the event is fired and the result is successful |
errorCallback? | function | A callback function that you provide that will be called when the event error is fired. |
Event | Callback payload type | Description |
---|---|---|
FORM_RESPONSE | BaseTokenResponse | Subscribe to a form submission and receive response in a callback payload. |
FORM_INITIALIZED | boolean | Fired when the form is initialized. |
SUBMIT_CLICKED | boolean | Fired when the form is submitted (only if preventImmediateSubmit is set to true ). |
ONE_CLICK_PAYMENT_SUBMIT | BaseTokenResponse | Fired when the form is submitted in OneClick payment screen. |
BaseTokenResponse example
{
"token": "tok_66ffHzdDykyzIvurMeNkig",
"pan": "4111111111111111",
"brand": "Visa",
"cvv": "123",
"expiration": "1234",
"kountSessionId": "d15ebdd8772agg069864020481f43ac5",
"lastFour": "1111",
"billingContact": {
"firstName": "James",
"lastName": "Bond",
"email": "test@mail.com",
"phone": "+111111111111",
"address": {
"lineOne": "line one",
"lineTwo": "line two",
"city": "Los Angeles",
"state": "CA",
"country": "USA",
"postalCode": "1231"
}
}
}
To receive pan
and kountSessionId
it needs to be configured in the admin panel.
cvv
and pan
will not return in the OneClick feature.
ErrorResponse example
{
"message": "Illegal card number."
}
Manually submit a form
cardSimple.submit()
Programmatically submit a form. For example when any action is needed to perform between
'Submit' button is clicked, and a form actually submits. Usually used when preventImmediateSubmit
is enabled.
Manually set billing contact
cardExtended.setBillingContact({
phone: '+11111111111',
address: {
country: 'USA',
postalCode: '1231',
state: 'CA',
city: 'Los Angeles',
lineOne: 'line one',
lineTwo: 'line two'
},
email: 'test@mail.com',
firstName: 'James',
lastName: 'Bond'
});
Manually sets billing contact in a form. Can be used both in card-extended
and card-simple
.
It auto fills form fields in the extended form and sends to token server in the simple form.
Can be used after the form is initialized.
Show success form state
cardSimple.showSuccess()
Show success state of a form.
Success state example
cardSimple.showSuccess();
Show error form state
cardSimple.showError(errorMessage)
Show error message under the submit button.
Failed state example
cardSimple.showError('Transaction failed');
Reset form
cardSimple.resetForm()
Reset a form to its default state.
Reset form example
cardSimple.resetForm();
Unmount Form from the DOM
cardSimple.unmount()
Removes Form
from the DOM if it is mounted.
Unmount example
cardSimple.unmount();
Custom payment form
There is a possibility to tokenize card without using pre-defined Globallypaid UI forms. SDK provides a function to tokenize input card.
Create token explicitly (V2)
gpg.createToken(cardNumber, cvv, expiration, zipCode).then(response => {
console.log(response);
// Do whatever you need with the token.
// Send a request to yours backend to perform a charge request
}).catch(error => {
console.log(error);
});
gpg.createToken(cardNumber, cvv, expiration, zipCode)
This method returns a Promise
with the TokenResponse
Parameter | Type | Description |
---|---|---|
cardNumber | string | Card number (e.g. 4111111111111111) |
cvv | string | Card CVV (e.g. 123) |
expiration | string | Card expiration date MMYY (e.g. 1224) |
zipCode | string | Zip code (e.g. 12345) |
TokenResponse
{
"id": "tok_66VIHzdDykyzIvurMeNkig",
"type": "CreditCard",
"customer_id": null,
"brand": "Visa",
"last_four": "1111",
"expiration": "1234",
"billing_contact": {
"first_name": "James",
"last_name": "Bond",
"address": {
"line_1": "line uno",
"line_2": "line doe",
"city": "Los Angeles",
"state": "CA",
"postal_code": "1231",
"country": "USA"
},
"phone": "+375297877018",
"email": "test@mail.com"
},
"is_default": false
}
Create token explicitly (V1)
const tokenRequestPayload = {
Payload: "4111111111111111",
Expiration: "1234",
CVV: "1234",
FirstName: "efsf",
LastName: "wefwe",
Address1: "fdsdgfg",
Address2: "123",
City: "fghfphlko",
State: "ca",
PostalCode: "36576",
Country: "USA",
Phone: "1234256545",
Email: "fwefw@dasd.com"
};
gpg.createToken(tokenRequestPayload).then(response => {
console.log(response);
// Do whatever you need with the token.
// Send a request to yours backend to perform a charge request
}).catch(error => {
console.log(error);
});
gpg.createToken(tokenRequestPayload)
This method returns a Promise
with the TokenResponseV1
TokenResponseV1
{
"Result": "SUCCESS",
"ResponseCode": "200",
"ProfileDetail": {
"Token": "4777770000000012",
"EmployeeID": "",
"CCLastFour": "1111",
"CCFirstFour": "4111",
"CCBrand": "Visa",
"ExpirationDate": "",
"FirstName": "James",
"LastName": "Bond",
"Address1": "line uno",
"Address2": "line doe",
"City": "Los Angeles",
"State": "CA",
"PostalCode": "1231",
"Country": "USA",
"Phone": null,
"Email": null
}
}
Code sample
const gpg = new GloballyPaidSDK('pk_live_...');
const cardExtended = gpg.createForm('card-extended', {
style: {
base: {
width: '560px'
}
},
common: {
preventImmediateSubmit: true
}
});
cardExtended.mount('gpg-form');
cardExtended.on('FORM_INITIALIZED', () => {
cardExtended.setBillingContact({
phone: '+1231435435',
address: {
country: 'USA',
postalCode: '1231',
state: 'CA',
city: 'Los Angeles',
lineOne: 'line one',
lineTwo: 'line two'
},
email: 'test@mail.com',
firstName: 'James',
lastName: 'Bond'
});
});
cardExtended.on('SUBMIT_CLICKED', () => {
// Your logic here
cardExtended.submit();
});
cardExtended.on('FORM_RESPONSE', (response) => {
// Your logic here
}, (error) => {
// Your logic here
cardExtended.showError(error.message);
});
cardExtended.on('ONE_CLICK_PAYMENT_SUBMIT', (oneClickData) => {
// Your logic here
}, (error) => {
// Your logic here
cardExtended.showError(error);
});