Initialization
  • 18 Jul 2024
  • 1 Minute to read

Initialization


Article summary

OrkestaPay Integration

Initialization

First, add the OrkestaPay script CDN:

<script type="text/javascript" src="https://checkout.orkestapay.com/script/orkestapay.js"></script>

Ensure the script is placed within the <body> tags to avoid errors. You will need your merchant_id and public_key from the developer portal. Initialize the OrkestaPay script:

const merchant_id = '{YOUR_MERCHANT_ID}';
const public_key = '{YOUR_PUBLIC_KEY_OR_DEVICE_KEY}';
const orkestapay = initOrkestaPay({ merchant_id, public_key });

For sandbox mode, include the optional is_sandbox property:

const is_sandbox = true;
const merchant_id = '{YOUR_MERCHANT_ID}';
const public_key = '{YOUR_PUBLIC_KEY_OR_DEVICE_KEY}';
const orkestapay = initOrkestaPay({ is_sandbox, merchant_id, public_key });

Retrieve Available Promotions

To get available promotions, use the getPromotions method with the required parameters:

  • bin_number (Required): The first 6 digits of the card number.

  • currency : The currency code.

  • total_amount (Required): The total amount to be paid.

(async function getPromotions() {
    const bin_number = '424242';
    const currency = 'MXN';
    const total_amount = '100.00';
    const promotions = await orkestapay.getPromotions({
        bin_number,
        currency,
        total_amount,
    });
})();

Retrieve Device Information

To get device information, use the getDeviceInfo method:

(async function getDeviceInfo() {
  const { device_session_id } = await orkestapay.getDeviceInfo();
})();

Models and entities

Function initOrkestaPay

function initOrkestaPay(orkestaPayParams: OrkestaPayParams): OrkestaPay;

Class OrkestaPay

class OrkestaPay {
  public createCard(mount_card_params?: MountCardParams): Promise<OrkestaPayCard>;
  public getPromotions(params: PromotionsParams): Promise<CardPromotion[]>;
  public getDeviceInfo(): Promise<DeviceInfo>;
}

Class OrkestaPayParams

class OrkestaPayParams {
  public merchant_id!: string;
  public public_key!: string;
  public is_sandbox?: boolean;
}

Class PromotionsParams

class PromotionsParams {
  public bin_number!: string;
  public currency!: string;
  public total_amount!: number | string;
}

Class CardPromotion

class CardPromotion {
  public type!: string;
  public installments!: number[];
}

Class DeviceInfo

class DeviceInfo {
  public device_session_id!: string;
  public fingerprint!: string;
}


Was this article helpful?

What's Next