Search Overlay

Exemples de formulaires de paiement et de retrait

L'exemple de code suivant montre un exemple minimal de Paysafe Checkout qui crée une superposition de paiement pour l'utilisateur. La superposition comporte un bouton de paiement qui crée un "payment handle" pour les données saisies par l'utilisateur et affiche le jeton de "payment handle" (en cas de succès) dans la console du navigateur.

Formulaire de paiement

<html><head><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" /><script src="https://hosted.paysafe.com/checkout/v2/paysafe.checkout.min.js"></script></head><body style="width :'100%'"><button onclick="checkout()"> Dépôt de 25 $ </button></body><script>

/***************************************************************Launch Call*********************************************************************/

function checkout() {
API_KEY = ; // Base 64 encoded Basic Auth
options = {
"devise": "USD",
"montant": 2500,
"singleUseCustomerToken": "singleUseCustomerToken",
"locale": "en_US",
"headerText": "Effectuer des paiements sécurisés avec la caisse",
"footerText": "Pour plus d'informations, veuillez nous contacter à l'adresse suivante : support@paysafe.com",
"amountoptions": [
500,
10500,
60000
],
"displayPaymentMethods": [
"applePay",
"carte",
"skrill",
"neteller",
"paysafecard",
"paysafecash",
"sightline",
"vippreferred",
"paypal",
"venmo",
"mazooma",
"ach",
"tef",
"interac",
"interac_etransfer",
"pagoefectivo",
"pix",
"boleto_flash",
"khipu",
"mach",
"spei",
"boleto_bancario",
"safetypay_bank_transfer",
"safetypay_cash"
],
"client": {
"firstName": "Sandi",
"lastName": "Smith",
"adresse courriel": "sandi.smith@paysafe.com",
"phone": "84632876432",
"dateOfBirth": {
"day": 23,
"month": 12,
"year": 1990
}
},
"billingAddress": {
"nickName": "John Dee",
"street": "Queen Street West",
"street2": "Queen Street",
"city": "Cupertino",
"zip": "14236",
"country": "US",
"state": "CA"
},
"environment": {
"url": "url",
"assetsUrl": "url"
},
"threeDs": {
"merchantUrl": "https://demostore.com/merchantUrl",
"deviceChannel": "BROWSER",
"messageCategory": "PAYMENT",
"transactionIntent": "GOODS_OR_SERVICE_PURCHASE",
"authenticationPurpose": "PAYMENT_TRANSACTION"
},
"merchantRefNum": "UUID",
"merchantDescriptor": {
"dynamicDescriptor": "Il s'agit d'un test de description pour le marchand",
"phone": "5555345456"
},
"shippingDetails": {
"recipientName": "John Doe",
"street": "20735 Stevens Creek Blvd",
"street2": "Montessori",
"city": "Cupertino",
"zip": "95014",
"country": "US",
"state": "CA"
},
"canEditAmount": true,
"paymentMethodDetails": {
"carte": {
"accountId": "CARD_ACCOUNT_ID" //if more than one Card accounts configured
},
"skrill": {
"consumerId": "SKRILL_CONSUMER_ID",
"emailSubject": "Objet du courriel à envoyer à l'utilisateur Skrill",
"emailMessage": "Corps du courriel à envoyer à l'utilisateur Skrill"
},
"neteller": {
"consumerId": "NETELLER_CONSUMER_ID"
},
"paysafecard": {
"consumerId": "PAYSAFECARD_CONSUMER_ID"
},
"paysafecash": {
"consumerId": "PAYSAFECASH_CONSUMER_ID"
},
"sightline": {
"consumerId": "SIGHTLINE_CONSUMER_ID",
"nas": "USER_SSN_NUMBER"
},
"vippreferred": {
"consumerId": "VIPPREFERRED_CONSUMER_ID"
},
"paypal": {
"consumerId": "PAYPAL_CONSUMERID",
"recipientType": "PAYPAL_ID"
},
"venmo": {
"consumerId": "VENMO_CONSUMERID"
},
"mazooma": {
"consumerId": "MAZOOMA_CONSUMER_ID"
},
"ach" : {
"accountId" : "ACH_ACCOUNT_ID" // if more than one EFT accounts configured
},
"tef" : {
"accountId":"EFT_ACCOUNT_ID" // if more than one ACH accounts configured
},
"interac": {
"merchantId": "INTERAC_MERCHANT_ID",
"storeId": "INTERAC_STORE_ID",
"apiKey": "INTERAC_API_KEY"
},
"interacEtransfer": {
"consumerId": "EMAIL_ID_OF_RECIPIENT",
"type": "ADRESSE COURRIEL",
"userCookie": "COOKIES",
"question": "Quel est le nom de votre animal préféré?",
"answer": "Pesho"
},
"pagoefectivo": {
"consumerId": "PAGOEFECTIVO_CONSUMER_ID"
},
"pix": {
"consumerId": "PIX_CONSUMER_ID"
},
"mach": {
"consumerId": "MACH_CONSUMER_ID"
},
"spei": {
"consumerId": "SPEI_CONSUMER_ID"
},
"boletoFlash": {
"consumerId": "SPEI_CONSUMER_ID"
},
"khipu": {
"consumerId": "KHIPU_CONSUMER_ID"
},
"boletoBancario": {
"consumerId": "BOLETOBANCARIO_CONSUMER_ID"
},
"safetyPayBankTransfer": {
"consumerId": "SAFETYPAYBANKTRANSFER_CONSUMER_ID"
},
"safetyPayCash": {
"consumerId": "SAFETYPAYCASH_CONSUMER_ID"
}
}
};


/***************************************************************Trigger Checkout Call*********************************************************************/


paysafe.checkout.setup(API_KEY, options,

function(instance, error, result) {
if (result) {
makePaymentWithPaymentHandleToken(instance, result); // Complete the payment call with Payment Handle Token
instance.showSuccessScreen(); // Show success screen
} else {
console.error(error);
instance.showFailureScreen();
return;
}
}, function(stage, expired) {
switch(stage) {
case "BeforePayment": // Handle the scenario
case "DuringPayment": // Handle the scenario
case "AfterPayment": // Handle the scenario
default: // Handle the scenario
}

});



}
</script></html>

Formulaire de retraite

<html><head><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" /><script src="https://hosted.paysafe.com/checkout/v2/paysafe.checkout.min.js"></script></head><body style="width :'100%'"><button onclick="checkout()"> Retrait de 25 $ </button></body><script>

/***************************************************************Launch Call*********************************************************************/

function checkout() {
API_KEY = ; // Base 64 encoded Basic Auth
options = {
"devise": "USD",
"payout": true,
"montant": 2500,
"singleUseCustomerToken": "singleUseCustomerToken",
"locale": "en_US",
"headerText": "Effectuer des retraits sécurisés lors du passage à la caisse",
"footerText": "Pour plus d'informations, veuillez nous contacter à l'adresse suivante : support@paysafe.com",
"amountoptions": [
500,
10500,
60000
],
"displayPaymentMethods": [
"carte",
"skrill",
"neteller",
"paysafecard",
"sightline",
"vippreferred",
"paypal",
"venmo",
"mazooma",
"interchecks",
"ach",
"tef",
"interac",
"interac_etransfer",
"
],
"customer": {
"firstName": "Sandi",
"lastName": "Smith",
"email": "sandi.smith@paysafe.com",
"phone": "84632876432",
"dateOfBirth": {
"day": 23,
"month": 12,
"year": 1990
}
},
"billingAddress": {
"nickName": "John Dee",
"street": "Queen Street West",
"street2": "Queen Street",
"city": "Cupertino",
"zip": "14236",
"country": "US",
"state": "CA"
},
"environment": {
"url": "url",
"assetsUrl": "url"
},
"threeDs": {
"merchantUrl": "https://demostore.com/merchantUrl",
"deviceChannel": "BROWSER",
"messageCategory": "PAYMENT",
"transactionIntent": "GOODS_OR_SERVICE_PURCHASE",
"authenticationPurpose": "PAYMENT_TRANSACTION"
},
"merchantRefNum": "UUID",
"merchantDescriptor": {
"dynamicDescriptor": "Il s'agit d'un test de description pour le marchand",
"phone": "5555345456"
},
"shippingDetails": {
"recipientName": "John Doe",
"street": "20735 Stevens Creek Blvd",
"street2": "Montessori",
"city": "Cupertino",
"zip": "95014",
"country": "US",
"state": "CA"
},
"canEditAmount": true, "paymentMethodDetails": {
"carte": {
"accountId": "CARD_ACCOUNT_ID" //if more than one Card accounts configured
},
"skrill": {
"consumerId": "SKRILL_CONSUMER_ID",
"emailSubject": "Objet du courriel à envoyer à l'utilisateur Skrill",
"emailMessage": "Corps du courriel à envoyer à l'utilisateur Skrill"
},
"neteller": {
"consumerId": "NETELLER_CONSUMER_ID"
},
"paysafecard": {
"consumerId": "PAYSAFECARD_CONSUMER_ID"
},
"paysafecash": {
"consumerId": "PAYSAFECASH_CONSUMER_ID"
},
"sightline": {
"consumerId": "SIGHTLINE_CONSUMER_ID",
"nas": "USER_SSN_NUMBER"
},
"vippreferred": {
"consumerId": "VIPPREFERRED_CONSUMER_ID"
},
"paypal": {
"consumerId": "PAYPAL_CONSUMERID",
"recipientType": "PAYPAL_ID"
},
"venmo": {
"consumerId": "VENMO_CONSUMERID"
},
"mazooma": {
"consumerId": "MAZOOMA_CONSUMER_ID"
},
"ach" : {
"accountId" : "ACH_ACCOUNT_ID" // if more than one EFT accounts configured
},
"tef" : {
"accountId":"EFT_ACCOUNT_ID" // if more than one ACH accounts configured
},
"interac": {
"merchantId": "INTERAC_MERCHANT_ID",
"storeId": "INTERAC_STORE_ID",
"apiKey": "INTERAC_API_KEY"
},
"interacEtransfer": {
"consumerId": "EMAIL_ID_OF_RECIPIENT",
"type": "ADRESSE COURRIEL",
"userCookie": "COOKIES",
"question": "Quel est le nom de votre animal préféré?",
"answer": "Pesho"
}
};


/***************************************************************Trigger Checkout Call*********************************************************************/


paysafe.checkout.setup(API_KEY, options,

function(instance, error, result) {
if (result) {
makeWithdrawalWithPaymentHandleToken(instance, result); // Complete AJAX Withdrawal call with Payment Handle Token
instance.showSuccessScreen(); // Show Success Screen
} else {
console.error(error);
instance.showFailureScreen(); // Show Failure Screen
return;
}
}, function(stage, expired) {
switch(stage) {
case "BeforePayment": // Handle the scenario
case "DuringPayment": // Handle the scenario
case "AfterPayment": // Handle the scenario
default: // Handle the scenario
}

});



}
</script></html>