Skip to content

Latest commit

 

History

History
1321 lines (751 loc) · 38.5 KB

README.md

File metadata and controls

1321 lines (751 loc) · 38.5 KB

Visit Bluesnap

At BlueSnap, we look at payments a little differently. Our Payment Orchestration Platform helps businesses accept payments globally and is designed to increase revenue and reduces costs. We provide a comprehensive back-end solutions that simplifies the complexity of payments, managing the full process from start to finish.

BlueSnap supports payments through multiple sales channels such as online and mobile sales, marketplaces, subscriptions, invoice payments and manual orders through a virtual terminal. And for businesses looking for embedded payments, we offer white-labeled payments for platforms with automated underwriting and onboarding that supports marketplaces and split payments.

And with one integration and contract, businesses can sell in over 200 geographies with access to local acquiring in 47 countries, 110+ currencies and 100+ global payment types, including popular eWallets, automated accounts receivable, world-class fraud protection and chargeback management, built-in solutions for regulation and tax compliance, and unified global reporting to help businesses grow.

With a US headquarters in Waltham, MA, and EU headquarters in Dublin, Ireland, BlueSnap is backed by world-class private equity investors including Great Hill Partners and Parthenon Capital Partners.

Learn more at BlueSnap.com

Table of Contents

Installation

Getting Started

import { BlueSnap } from "blue-snap-typescript-sdk";

const bluesnap = new BlueSnap({
  // Defining the base path is optional and defaults to https://sandbox.bluesnap.com/services/2
  // basePath: "https://sandbox.bluesnap.com/services/2",
  apiKey: "API_KEY",
});

const createDebitForAusCanResponse =
  await bluesnap.agreement.createDebitForAusCan({
    region: "ca",
    type: "onetime",
  });

console.log(createDebitForAusCanResponse);

Reference

bluesnap.agreement.createDebitForAusCan

for Australia and Canada

🛠️ Usage

const createDebitForAusCanResponse =
  await bluesnap.agreement.createDebitForAusCan({
    region: "ca",
    type: "onetime",
  });

⚙️ Parameters

region: string

Represents the country. Possible Values: au, ca

type: string

Represents the mandate type. Possible Values: onetime,recurring, ondemand

planid: string

SKU number

overriderecurringchargeamount: string

the amount which overrides recurring charge

🌐 Endpoint

/agreements/debit/{region}/{type} POST

🔙 Back to Table of Contents


bluesnap.agreement.getDebit

for Australia and Canada

🛠️ Usage

const getDebitResponse = await bluesnap.agreement.getDebit({
  agreementId: "1065",
});

⚙️ Parameters

agreementId: string

Argument included in the response for the Create Debit Agreement request

🌐 Endpoint

/agreements/{agreementId} GET

🔙 Back to Table of Contents


bluesnap.authorization.createTransaction

🛠️ Usage

const createTransactionResponse =
  await bluesnap.authorization.createTransaction({
    amount: 11,
    softDescriptor: "DescTest",
    currency: "USD",
    cardTransactionType: "AUTH_ONLY",
  });

⚙️ Parameters

amount: number
softDescriptor: string
currency: string
cardTransactionType: string

🌐 Endpoint

/transactions POST

🔙 Back to Table of Contents


bluesnap.plan.createRecurringPlan

🛠️ Usage

const createRecurringPlanResponse = await bluesnap.plan.createRecurringPlan({
  chargeFrequency: "MONTHLY",
  gracePeriodDays: 10,
  trialPeriodDays: 14,
  initialChargeAmount: 100,
  name: "Gold Plan",
  currency: "USD",
  maxNumberOfCharges: 12,
  recurringChargeAmount: 29.99,
  chargeOnPlanSwitch: true,
});

⚙️ Parameters

chargeFrequency: string
gracePeriodDays: number
trialPeriodDays: number
initialChargeAmount: number
name: string
currency: string
maxNumberOfCharges: number
recurringChargeAmount: number
chargeOnPlanSwitch: boolean

🌐 Endpoint

/recurring/plans POST

🔙 Back to Table of Contents


bluesnap.plan.getAll

🛠️ Usage

const getAllResponse = await bluesnap.plan.getAll({
  pagesize: "5",
  after: "2185254",
  gettotal: true,
  fulldescription: false,
});

⚙️ Parameters

pagesize: string
after: string
gettotal: boolean
fulldescription: boolean

🌐 Endpoint

/recurring/plans?{parameters} GET

🔙 Back to Table of Contents


bluesnap.plan.getSpecific

🛠️ Usage

const getSpecificResponse = await bluesnap.plan.getSpecific({
  planId: 2283845,
});

⚙️ Parameters

planId: number

BlueSnap identifier for the plan.

🌐 Endpoint

/recurring/plans/{planId} GET

🔙 Back to Table of Contents


bluesnap.plan.updateRecurringPlan

🛠️ Usage

const updateRecurringPlanResponse = await bluesnap.plan.updateRecurringPlan({
  planId: 2111111,
  chargeFrequency: "MONTHLY",
  trialPeriodDays: "7",
  initialChargeAmount: "30",
  name: "Gold Plan",
  currency: "USD",
  recurringChargeAmount: "19",
});

⚙️ Parameters

planId: number

BlueSnap identifier for the plan.

chargeFrequency: string
trialPeriodDays: string
initialChargeAmount: string
name: string
currency: string
recurringChargeAmount: string

🌐 Endpoint

/recurring/plans/{planId} PUT

🔙 Back to Table of Contents


bluesnap.reversal.authTransaction

🛠️ Usage

const authTransactionResponse = await bluesnap.reversal.authTransaction({
  cardTransactionType: "AUTH_REVERSAL",
  transactionId: 1011671987,
});

⚙️ Parameters

cardTransactionType: string
transactionId: number

🌐 Endpoint

/transactions PUT

🔙 Back to Table of Contents


bluesnap.shopper.createVaultedShopper

🛠️ Usage

const createVaultedShopperResponse =
  await bluesnap.shopper.createVaultedShopper({
    firstName: "FirstName",
    lastName: "LastName",
  });

⚙️ Parameters

firstName: string
lastName: string

🌐 Endpoint

/vaulted-shoppers POST

🔙 Back to Table of Contents


bluesnap.shopper.deleteVaultedShopper

🛠️ Usage

const deleteVaultedShopperResponse =
  await bluesnap.shopper.deleteVaultedShopper({
    vaultedShopperId: "20769005",
  });

⚙️ Parameters

vaultedShopperId: string

vaultedShopperId received from BlueSnap

🌐 Endpoint

/vaulted-shoppers/{vaultedShopperId} DELETE

🔙 Back to Table of Contents


bluesnap.shopper.get

🛠️ Usage

const getResponse = await bluesnap.shopper.get({
  vaultedShopperId: "20769005",
});

⚙️ Parameters

vaultedShopperId: string

vaultedShopperId received from BlueSnap

🌐 Endpoint

/vaulted-shoppers/{vaultedShopperId} GET

🔙 Back to Table of Contents


bluesnap.shopper.updateVaultedShopper

🛠️ Usage

const updateVaultedShopperResponse =
  await bluesnap.shopper.updateVaultedShopper({
    vaultedShopperId: "40444721",
    firstName: "FirstName",
    lastName: "LastName",
  });

⚙️ Parameters

vaultedShopperId: string

vaultedShopperId received from BlueSnap

firstName: string
lastName: string

🌐 Endpoint

/vaulted-shoppers/{vaultedShopperId} PUT

🔙 Back to Table of Contents


bluesnap.subscription.createMerchantManagedCharge

🛠️ Usage

const createMerchantManagedChargeResponse =
  await bluesnap.subscription.createMerchantManagedCharge({
    subscriptionId: 10543419,
    amount: 45,
    currency: "USD",
    merchantTransactionId: "MyUniqueOnDemandSubscription",
    taxReference: "048deff0-a285-47e1-bc39-42f79bf0095b",
  });

⚙️ Parameters

subscriptionId: number

BlueSnap identifier for the subscription.

amount: number
currency: string
merchantTransactionId: string
taxReference: string

🌐 Endpoint

/recurring/ondemand/{subscriptionId} POST

🔙 Back to Table of Contents


bluesnap.subscription.createMerchantManagedSubscription

🛠️ Usage

const createMerchantManagedSubscriptionResponse =
  await bluesnap.subscription.createMerchantManagedSubscription({
    amount: 45,
    currency: "USD",
  });

⚙️ Parameters

amount: number
currency: string

🌐 Endpoint

/recurring/ondemand POST

🔙 Back to Table of Contents


bluesnap.subscription.createNew

🛠️ Usage

const createNewResponse = await bluesnap.subscription.createNew({
  planId: 2283845,
});

⚙️ Parameters

planId: number

🌐 Endpoint

/recurring/subscriptions POST

🔙 Back to Table of Contents


bluesnap.subscription.getSpecific

🛠️ Usage

const getSpecificResponse = await bluesnap.subscription.getSpecific({
  subscriptionId: 8491535,
});

⚙️ Parameters

subscriptionId: number

BlueSnap identifier for the subscription.

🌐 Endpoint

/recurring/subscriptions/{subscriptionId} GET

🔙 Back to Table of Contents


bluesnap.subscription.getSwitchChargeAmount

🛠️ Usage

const getSwitchChargeAmountResponse =
  await bluesnap.subscription.getSwitchChargeAmount({
    newplanid: "111111",
    newquantity: "2",
  });

⚙️ Parameters

newplanid: string
newquantity: string

🌐 Endpoint

/recurring/subscriptions/:subscriptionId/switch-charge-amount GET

🔙 Back to Table of Contents


bluesnap.subscription.listAllSubscriptions

🛠️ Usage

const listAllSubscriptionsResponse =
  await bluesnap.subscription.listAllSubscriptions({
    pagesize: "5",
    after: "34567",
    gettotal: true,
    fulldescription: false,
  });

⚙️ Parameters

pagesize: string
after: string
gettotal: boolean
fulldescription: boolean

🌐 Endpoint

/recurring/subscriptions?{parameters} GET

🔙 Back to Table of Contents


bluesnap.subscription.listCharges

🛠️ Usage

const listChargesResponse = await bluesnap.subscription.listCharges({
  pagesize: "3",
  after: "163193",
  fulldescription: false,
});

⚙️ Parameters

pagesize: string
after: string
fulldescription: boolean

🌐 Endpoint

/:subscriptionId/charges?{parameters} GET

🔙 Back to Table of Contents


bluesnap.subscription.updateSubscription

🛠️ Usage

const updateSubscriptionResponse =
  await bluesnap.subscription.updateSubscription({
    subscriptionId: 8491543,
    planId: "2283849",
  });

⚙️ Parameters

subscriptionId: number

BlueSnap identifier for the subscription.

planId: string

🌐 Endpoint

/recurring/subscriptions/{subscriptionId} PUT

🔙 Back to Table of Contents


bluesnap.transaction.approveMerchantTransaction

🛠️ Usage

const approveMerchantTransactionResponse =
  await bluesnap.transaction.approveMerchantTransaction({
    transactionid: "38612140",
    approvetransaction: true,
  });

⚙️ Parameters

transactionid: string

either transactionid or merchanttransactionid is required
ID of the transaction to be approved/declined

approvetransaction: boolean

Set to true to approve the transaction or to false to decline the transaction. Default value is true.

🌐 Endpoint

/transactions/approval PUT

🔙 Back to Table of Contents


bluesnap.transaction.cancelPendingRefund

🛠️ Usage

const cancelPendingRefundResponse =
  await bluesnap.transaction.cancelPendingRefund({
    transactionId: "1109144995",
  });

⚙️ Parameters

transactionId: string

transactionId received from BlueSnap

🌐 Endpoint

/transactions/pending-refund/{transactionId} DELETE

🔙 Back to Table of Contents


bluesnap.transaction.createBatchTransaction

🛠️ Usage

const createBatchTransactionResponse =
  await bluesnap.transaction.createBatchTransaction({});

⚙️ Parameters

🌐 Endpoint

/batch-transactions POST

🔙 Back to Table of Contents


bluesnap.transaction.createSofortTransaction

🛠️ Usage

const createSofortTransactionResponse =
  await bluesnap.transaction.createSofortTransaction({
    amount: 42,
    softDescriptor: "ABC COMPANY",
    currency: "GBP",
    authorizedByShopper: true,
  });

⚙️ Parameters

amount: number
softDescriptor: string
currency: string
authorizedByShopper: boolean

🌐 Endpoint

/alt-transactions POST

🔙 Back to Table of Contents


bluesnap.transaction.getBatchTransaction

🛠️ Usage

const getBatchTransactionResponse =
  await bluesnap.transaction.getBatchTransaction({
    batchId: "567890",
  });

⚙️ Parameters

batchId: string

batch ID sent in the Create Batch Transaction request

🌐 Endpoint

/batch-transactions/{batchId} GET

🔙 Back to Table of Contents


bluesnap.transaction.getById

🛠️ Usage

const getByIdResponse = await bluesnap.transaction.getById({
  transactionId: "1011582369",
});

⚙️ Parameters

transactionId: string

transaction ID received in the response from BlueSnap

🌐 Endpoint

/transactions/{transactionId} GET

🔙 Back to Table of Contents


bluesnap.transaction.getPaypalTransaction

🛠️ Usage

const getPaypalTransactionResponse =
  await bluesnap.transaction.getPaypalTransaction({
    orderId: "5666625",
  });

⚙️ Parameters

orderId: string

order ID received in the response

🌐 Endpoint

/alt-transactions/resolve?orderId={orderId} GET

🔙 Back to Table of Contents


bluesnap.transaction.getPreNotificationDebitAgreement

for Australia and Canada

🛠️ Usage

const getPreNotificationDebitAgreementResponse =
  await bluesnap.transaction.getPreNotificationDebitAgreement({
    transactionId: "38943468",
  });

⚙️ Parameters

transactionId: string

Argument included in the response for the Create Debit Agreement request

🌐 Endpoint

/agreements/prenotification/{transactionId} GET

🔙 Back to Table of Contents


bluesnap.transaction.getSepaDd

🛠️ Usage

const getSepaDdResponse = await bluesnap.transaction.getSepaDd({
  transactionId: "1014672453",
});

⚙️ Parameters

transactionId: string

transaction ID received in the response from BlueSnap

🌐 Endpoint

/alt-transactions/{transactionId} GET

🔙 Back to Table of Contents


bluesnap.transaction.getSofortTransaction

🛠️ Usage

const getSofortTransactionResponse =
  await bluesnap.transaction.getSofortTransaction({
    orderId: 20922493,
  });

⚙️ Parameters

orderId: number

Order ID received in the Create Sofort Transaction response from BlueSnap

🌐 Endpoint

/alt-transactions/resolve GET

🔙 Back to Table of Contents


bluesnap.transaction.initiateRefund

🛠️ Usage

const initiateRefundResponse = await bluesnap.transaction.initiateRefund({
  transactionId: "1095710747",
  reason: "Refund for order #1992",
  cancelSubscriptions: false,
});

⚙️ Parameters

transactionId: string

ID of the transaction to be refunded
Required if not using merchantTransactionId

reason: string
cancelSubscriptions: boolean

🌐 Endpoint

/transactions/refund/{transactionId} POST

🔙 Back to Table of Contents


bluesnap.transaction.updatePaypalTransaction

🛠️ Usage

const updatePaypalTransactionResponse =
  await bluesnap.transaction.updatePaypalTransaction({
    amount: 105,
    currency: "USD",
  });

⚙️ Parameters

amount: number
currency: string

🌐 Endpoint

/alt-transactions PUT

🔙 Back to Table of Contents


bluesnap.vendor.create

🛠️ Usage

const createResponse = await bluesnap.vendor.create({
  email: "vendor@example.com",
  firstName: "Joe",
  lastName: "Smith",
  phone: "1-123-456-7890",
  address: "123 Main Street",
  city: "Boston",
  country: "US",
  state: "MA",
  zip: "02453",
  defaultPayoutCurrency: "USD",
  ipnUrl: "https://ipnaddress.com",
});

⚙️ Parameters

email: string
firstName: string
lastName: string
phone: string
address: string
city: string
country: string
state: string
zip: string
defaultPayoutCurrency: string
ipnUrl: string
payoutInfo: object

🌐 Endpoint

/vendors POST

🔙 Back to Table of Contents


bluesnap.vendor.getAllVendors

🛠️ Usage

const getAllVendorsResponse = await bluesnap.vendor.getAllVendors({
  gettotal: true,
});

⚙️ Parameters

gettotal: boolean

🌐 Endpoint

/vendors?{parameters} GET

🔙 Back to Table of Contents


bluesnap.vendor.getVendor

🛠️ Usage

const getVendorResponse = await bluesnap.vendor.getVendor({
  vendorId: 837389,
});

⚙️ Parameters

vendorId: number

BlueSnap identifier for the vendor

🌐 Endpoint

/vendors/{vendorId} GET

🔙 Back to Table of Contents


bluesnap.vendor.updateVendor

🛠️ Usage

const updateVendorResponse = await bluesnap.vendor.updateVendor({
  vendorId: 1,
  email: "vendor@bluesnap.com",
  name: "Important Vendor",
  firstName: "Joe",
  lastName: "Smith",
  address: "123 Main Street",
  city: "testing city",
  zip: "02453",
  country: "US",
  phone: "1-054-976-6778",
  state: "MA",
  taxId: 123456789,
  vendorUrl: "http://mycompany.com",
  ipnUrl: "https://ipnaddress.com",
  defaultPayoutCurrency: "USD",
});

⚙️ Parameters

vendorId: number

BlueSnap identifier for the vendor

email: string
name: string
firstName: string
lastName: string
address: string
city: string
zip: string
country: string
phone: string
state: string
taxId: number
vendorUrl: string
ipnUrl: string
defaultPayoutCurrency: string

🌐 Endpoint

/vendors/{vendorId} PUT

🔙 Back to Table of Contents


Author

This TypeScript package is automatically generated by Konfig