Search Overlay

Coffre-fort client

L’API Coffre-fort client vous permet de créer des profils de clients contenant leurs informations de paiement; c’est-à-dire des jetons, puis d’effectuer des paiements répétés sans avoir à accéder directement aux informations de paiement sensibles. Il s’agit d’une méthode très efficace et sûre pour permettre aux clients de payer régulièrement.

Cliquez sur les liens ci-dessous pour voir nos exemples de code.

Vérifier l’accessibilité du service

is_online = client.customer_vault_service.monitor
                                

Profil client

profile = Paysafe::CustomerVault::Profile.new({
merchantCustomerId: "0f8fad5bd9cb469fa16570867728950e",
locale: "en_US",
firstName: "John",
lastName: "Smith",
email: "john.smith@somedomain.com",
phone: "713-444-5555"
})

response = client.customer_vault_service.create_profile profile

profile = Paysafe::CustomerVault::Profile.new({
merchantCustomerId: "0f8fad5bd9cb469fa16570867728950e",
locale: "en_US",
firstName: "John",
lastName: "Smith",
email: "john.smith@somedomain.com",
phone: "713-444-5555",
card: { singleUseToken: "SCO0Jpx9JUP9hESh" }
})

response = client.customer_vault_service.create_profile profile

profile = Paysafe::CustomerVault::Profile.new({
id: profile_id
})

response = client.customer_vault_service.get_profile profile

profile_obj = Paysafe::CustomerVault::Profile.new({
id: profile_id
})

profile = client.customer_vault_service.get_profile profile_obj
profile.firstName = "Jack"
response = client.customer_vault_service.update_profile profile

profile_obj = Paysafe::CustomerVault::Profile.new({
id: profile_id
})

response = client.customer_vault_service.delete_profile profile_obj

Adresses au profil

address = Paysafe::CustomerVault::Address.new({
profileID: profile_id,
nickName: "home",
street: "100 Queen Street West",
street2: "Unit 201",
city: "Toronto",
country: "CA",
state: "ON",
zip: "M5H 2N2",
recipientName: "Jane Doe",
phone: "647-788-3901"
})

response = client.customer_vault_service.create_address address

address_obj = Paysafe::CustomerVault::Address.new({
id: address_id,
profileID: profile_id
})

response = client.customer_vault_service.get_address address_obj

address_obj = Paysafe::CustomerVault::Address.new({
id: address_id,
profileID: profile_id
})

address = client.customer_vault_service.get_address address_obj
address.nickName = "NEW HOME"
response = client.customer_vault_service.update_address address

address_obj = Paysafe::CustomerVault::Address.new({
id: address_id,
profileID: profile_id
})

response = client.customer_vault_service.delete_address address_obj

Cartes au profil

card_obj = Paysafe::CustomerVault::Card.new({
profileID: profile_id
nickName: "John's corporate Visa",
cardNum: "4111111111111111",
cardExpiry: {
month: "06",
year: "2020"
},
billingAddressId: address_id
})

response = client.customer_vault_service.create_card card_obj

card_obj = Paysafe::CustomerVault::Card.new({
id: card_id,
profileID: profile_id
})

response = client.customer_vault_service.get_card card_obj

card_obj = Paysafe::CustomerVault::Card.new({
id: card_id,
profileID: profile_id,
})
card_obj.nickName = "NEW CARD NAME"
card = client.customer_vault_service.update_card card_obj

card_obj = Paysafe::CustomerVault::Card.new({
id: card_id,
profileID: profile_id
})

response = client.customer_vault_service.delete_card card_obj

Comptes bancaires au profil

Gestion des comptes bancaires ACH

ach_bank_account_obj = Paysafe::CustomerVault::AchBankAccount.new({
nickName: "John",
accountNumber: rand(1000..10000000000000000),
routingNumber: "123456789",
accountHolderName: "XYZ Business",
billingAddressId: address_id,
accountType: "CHECKING",
profileID: profile_id
})

response = get_client.customer_vault_service.create_ach_bank_account ach_bank_account_obj

ach_bank_account_obj = Paysafe::CustomerVault::AchBankAccount.new({
id: ach_bank_account_id,
profileID: profile_id
})
response = get_client.customer_vault_service.get_ach_bank_account ach_bank_account_obj

ach_bank_account_obj = Paysafe::CustomerVault::AchBankAccount.new({
id: ach_bank_account_id,
profileID: profile_id
})
account_obj = get_client.customer_vault_service.get_ach_bank_account ach_bank_account_obj
account_obj.nickName = "NEW ACCOUNT NAME"
response = get_client.customer_vault_service.update_ach_bank_account account_obj

ach_bank_account_obj = Paysafe::CustomerVault::AchBankAccount.new({
id: ach_bank_account_id,
profileID: profile_id
})
response = get_client.customer_vault_service.delete_ach_bank_account ach_bank_account_obj

Gestion des comptes bancaires BACS

bacs_bank_account_obj = Paysafe::CustomerVault::BacsBankAccount.new({
nickName: "Sally's Account",
sortCode: "070116",
accountHolderName: "Tim",
accountNumber: "34898396",
billingAddressId: address_id,
profileID: profile_id
})
response = get_client.customer_vault_service.create_bacs_bank_account bacs_bank_account_obj

bacs_bank_account_obj_mandate = Paysafe::CustomerVault::BacsBankAccount.new({
nickName: "Sally's Barclays Account",
accountNumber: "34898396",
sortCode: "070116",
accountHolderName: "Sally",
billingAddressId: address_id,
profileID: profile_id,
mandates: [
reference: "ABCDEFGHIJ",
]
})
response = get_bacs_client.customer_vault_service.create_bacs_bank_account_with_mandate bacs_bank_account_obj_mandate

bacs_bank_account_obj = Paysafe::CustomerVault::BacsBankAccount.new({
id: bacs_bank_account_id,
profileID: profile_id
})
response = get_client.customer_vault_service.get_bacs_bank_account bacs_bank_account_obj

bacs_bank_account_obj = Paysafe::CustomerVault::BacsBankAccount.new({
id: bacs_bank_account_id,
profileID: profile_id
})
account_obj = get_client.customer_vault_service.get_bacs_bank_account bacs_bank_account_obj
account_obj.nickName = "Sally's Account"
response = get_client.customer_vault_service.update_bacs_bank_account account_obj

bacs_bank_account_obj = Paysafe::CustomerVault::BacsBankAccount.new({
id: bacs_bank_account_id,
profileID: profile_id
})
response = get_client.customer_vault_service.delete_bacs_bank_account bacs_bank_account_obj

Gestion des comptes bancaires TEF

eft_bank_account_obj = Paysafe::CustomerVault::EftBankAccount.new({
nickName: "Sally's Bank of Montreal Account",
accountNumber: rand(1000..10000000000),
transitNumber: "25039",
accountHolderName: "LMN Business",
billingAddressId: address_id,
institutionId: "001",
profileID: profile_id
})
response = get_client.customer_vault_service.create_eft_bank_account eft_bank_account_obj

eft_bank_account_obj = Paysafe::CustomerVault::EftBankAccount.new({
id: eft_bank_account_id,
profileID: profile_id,
})
response = get_client.customer_vault_service.get_eft_bank_account eft_bank_account_obj

eft_bank_account_obj = Paysafe::CustomerVault::EftBankAccount.new({
id: eft_bank_account_id,
profileID: profile_id
})
account_obj = get_client.customer_vault_service.get_eft_bank_account eft_bank_account_obj
account_obj.nickName = "Sally's Bank of Montreal Account"
response = get_client.customer_vault_service.update_eft_bank_account account_obj

eft_bank_account_obj = Paysafe::CustomerVault::EftBankAccount.new({
id: eft_bank_account_id,
profileID: profile_id
})
response = get_client.customer_vault_service.delete_eft_bank_account eft_bank_account_obj

Gestion des comptes bancaires SEPA

sepa_bank_account_obj = Paysafe::CustomerVault::SepaBankAccount.new({
nickName: "Sally's Account",
iban: "TR079861528612024839757894",
bic: "ABNANL2A",
accountHolderName: "Tim",
billingAddressId: address_id,
profileID: profile_id
})
response = get_client.customer_vault_service.create_sepa_bank_account sepa_bank_account_obj

sepa_bank_account_obj_mandate = Paysafe::CustomerVault::SepaBankAccount.new({
nickName: "Sally's Account",
iban: "TR079861528612024839757894",
bic: "ABNANL2A",
accountHolderName: "Sally",
billingAddressId: address_id,
profileID: profile_id,
mandates: [
reference: "ABCDEFGHIJ10987",
]
})
response = get_sepa_client.customer_vault_service.create_sepa_bank_account_with_mandate sepa_bank_account_obj_mandate

sepa_bank_account_obj = Paysafe::CustomerVault::SepaBankAccount.new({
id: sepa_bank_account_id,
profileID: profile_id,
})
response = get_client.customer_vault_service.get_sepa_bank_account sepa_bank_account_obj

sepa_bank_account_obj = Paysafe::CustomerVault::SepaBankAccount.new({
id: sepa_bank_account_id,
profileID: profile_id
})
account_obj = get_client.customer_vault_service.get_sepa_bank_account sepa_bank_account_obj
account_obj.nickName = "Sally's Account"
response = get_client.customer_vault_service.update_sepa_bank_account account_obj

sepa_bank_account_obj = Paysafe::CustomerVault::SepaBankAccount.new({
id: sepa_bank_account_id,
profileID: profile_id
})
response = get_client.customer_vault_service.delete_sepa_bank_account sepa_bank_account_obj

Mandats

bacs_mandate_obj = Paysafe::CustomerVault::Mandate.new({
reference: get_bacs_mandate_reference,
bankAccountId: bacs_bank_account_id,
profileID: profile_id
})
response = get_bacs_client.customer_vault_service.create_bacs_mandate bacs_mandate_obj

sepa_mandate_obj = Paysafe::CustomerVault::Mandate.new({
reference: "SUBSCRIPTION103",
bankAccountId: sepa_bank_account_id,
profileID: profile_id
})
response = get_sepa_client.customer_vault_service.create_sepa_mandate sepa_mandate_obj

mandate_obj = Paysafe::CustomerVault::Mandate.new({
id: mandate_id,
profileID: profile_id
})
response = get_client.customer_vault_service.get_mandate mandate_obj

mandte_obj = Paysafe::CustomerVault::Mandate.new({
id: mandate_id,
profileID: profile_id
})
mandate_res_obj = get_client.customer_vault_service.get_mandate mandte_obj
mandate_res_obj.status = "CANCELLED"
response = get_client.customer_vault_service.update_mandate mandate_res_obj

mandate_obj = Paysafe::CustomerVault::Mandate.new({
id: mandate_id,
profileID: profile_id
})
response = get_client.customer_vault_service.delete_mandate mandate_obj

Traiter un paiement à l’aide d’un jeton de paiement

auth_obj = Paysafe::CardPayments::Authorization.new({
merchantRefNum: "0f8fad5bd9cb469fa16570867728950e",
amount: 555,
settleWithAuth: false,
card: { paymentToken: card.paymentToken }
})

response = client.card_payment_service.authorize auth_obj

verify_obj = Paysafe::CardPayments::Verification.new({
merchantRefNum: "0f8fad5bd9cb469fa16570867728950e",
card: { paymentToken: card.paymentToken }
})

response = client.card_payment_service.verify verify_obj