PayFort supports MasterPass, Visacheckout and ApplePay.
MasterPass
As another move towards a cashless environment, PayFort provides MasterPass. It is a digital wallet that securely stores your buyer’s credit card details and shipping addresses, making shopping through thousands of online Merchants simple and convenient. This is fulfilled by enhancing and simplifying the buyer’s digital shopping experience.
Service Endpoints
Sandbox
POST https://sbcheckout.payfort.com/FortAPI/paymentPage
Live
POST https://checkout.payfort.com/FortAPI/paymentPage
Redirection
Integration Flow
-
You submit a form that includes all the parameters and call the following url to be redirected to PayFort as mentioned in the service endpoints
-
The PayFORT returns a response to the request which you sent in step 1.
-
The payFORT inserts the response parameters into a JavaScript.
-
A lightbox appears to the buyer where he enters his credentials, selects the card type and the shipping address, and clicks “Finish Shopping”.
-
The payFORT either proceeds to Authorize or Purchase the payment based on the value of the command parameter sent in your request form.
-
The payFORT returns a response to the request sent to it in step5.(Please refer to section MasterPass Service - Response for the Response Parameters).
Parameters Submission Type
HTTPs Form Post Request.
Service Request Example
Below is the sample html request.
placeholder: add code for request
The following is an example for “cart_details” parameter:
placeholder: add code for card_details parameter
MasterPass Hosted
Masterpass Hosted accepts digital wallet transactions without redirection to Masterpass pages, instead it will be hosted on the Merchant website.
VisaCheckout
Visa Checkout is a digital wallet that securely stores the customer's credit card details and shipping addresses and information, making shopping through thousands of online Merchants simple and convenient. This service enhances and simplifies the buyer’s online shopping experience. Visa Checkout can be offered through two different integrations:
Merchant Hosted Checkout Button
Integration Flow
This integration allows the you to host Visa Checkout button on your website giving you maximum control over the look and feel and user experience. The following steps describe how this integration works:
- You should include the following JavaScript in the HTML header of its checkout page. This JavaScript loads the Visa Checkout library and defines handlers to initialization and payment events.
<head>
<script type="text/javascript">
function onVisaCheckoutReady() {
V.init({
apikey : “#API_KEY#”, // This will be provided by PayFort
externalProfileId : “#PROFILE_NAME#”, // This will be provided by PayFort
settings : {
locale : “en_AE”,
countryCode : “AE”, // depends on ISO-3166-1 alpha-2 standard codes
review : {
message : “Merchant defined message”, //
buttonAction : “Continue” // The button label
},
threeDSSetup : {
threeDSActive : “false” // true to enable the 3ds false to disable it
}
},
paymentRequest : {
currencyCode : “USD”, //depends on ISO 4217 standard alpha-3 code values
subtotal : “10.00”, // Subtotal of the payment.
}
});
V.on(“payment.success”, function(payment) {
document.write(JSON.stringify(payment)); //response when received success operation
});
V.on(“payment.cancel”, function(payment) {
document.write(JSON.stringify(payment)); //response when cancel operation
});
V.on(“payment.error”, function(payment, error) {
document.write(JSON.stringify(payment));//response when received error operation
document.write(error);
});
}
</script>
</head>
- You should use the following class to render Visa Checkout button that a consumer clicks to initiate a payment.
<body>
<img alt=“Visa Checkout” class=“v-button” role=“button”
src=“https://sandbox.secure.checkout.visa.com/wallet-services-web/xo/button.png?cardBrands=VISA,MASTERCARD” />
</body>
Endpoints
Sandbox
https://sandbox.secure.checkout.visa.com/wallet-services-web/xo/button.png
Live
https://secure.checkout.visa.com/wallet-services-web/xo/button.png
- You should use the following JavaScript to control the operation on Visa Checkout on the website.
<body>
<script type=“text/javascript”
src=“https://sandbox-assets.secure.checkout.visa.com/checkout-widget/resources/js/integration/v1/sdk.js”>
</script>
</body>
- After completing the previous steps, the consumer clicks on Visa Checkout button, Visa Checkout light box appears and the user complete the checkout process.
- You will receive a successful response. The response associated with the payment success event returns list of parameters. The Merchant has to collect the value of “call_id” parameter to be used in the following step.
- You submit Purchase request to the FORT adding 2 extra parameters: digital-wallet, call_id. Please refer to Merchant Hosted Visa Checkout - Request for more details.
- The Merchant system receives the FORT’s purchase request and then uses Visa Checkout update image pixel. Below you can find an example of how to use Visa Checkout update image pixel. Please refer to “Visa checkout PayFort documentation” for more details.
<img src=“https://sandbox.secure.checkout.visa.com/wallet-services-web/payment/updatepaymentinfo.gif?apikey=…&callId=…¤cyCode=USD&total=11.00&subtotal=11.00” />
The following example shows an HTML web page that loads the Visa Checkout library, defines handlers for initialization and payment events, and creates a Visa Checkout button:
<html>
<head>
<script type=“text/javascript”>
function onVisaCheckoutReady() {
V.init({
apikey : “#API_KEY#”, // This will be provided by PayFort
externalProfileId : “#PROFILE_NAME#”, // This will be provided by PayFort
settings : {
locale : “en_AE”,
countryCode : “AE”, // depends on ISO-3166-1 alpha-2 standard codes
review : {
message : “Merchant defined message”, //
buttonAction : “Continue” // The button label
},
threeDSSetup : {
threeDSActive : “false” // true to enable the 3ds false to disable it
}
},
paymentRequest : {
currencyCode : “USD”, //depends on ISO 4217 standard alpha-3 code values
subtotal : “10.00”, // Subtotal of the payment.
}
});
V.on(“payment.success”, function(payment) {
document.write(JSON.stringify(payment)); // response when received success operation
});
V.on(“payment.cancel”, function(payment) {
document.write(JSON.stringify(payment)); // response when cancel operation
});
V.on(“payment.error”, function(payment, error) {
document.write(JSON.stringify(payment));// response when received error operation
document.write(error);
});
}
</script>
</head>
<body>
<img alt=“Visa Checkout” class=“v-button” role=“button"src="https://sandbox.secure.checkout.visa.com/wallet-services-web/xo/button.png?cardBrands=VISA,MASTERCARD,DISCOVER,AMEX” />
<script type=“text/javascript” src=“https://sandbox-assets.secure.checkout.visa.com/checkout-widget/resources/js/integration/v1/sdk.js”>
</script>
</body>
</html>
Apple Pay
Start seamlessly accepting credit card payments from your customers via Touch ID and Face ID, eliminating the need for them to manually type in their card and shipping details.
When using a credit or debit card with Apple Pay, the actual card numbers are not stored on the device, or on Apple servers. Instead, a unique Device Account Number is assigned, encrypted and securely stored in the Secure Element on your device, where each transaction is authorized with a one-time unique dynamic security code.
SUPPORTED DEVICES
Refer to Apple’s compatibility documentation to learn which devices support Apple Pay.
PayFort users can accept Apple Pay in iOS applications in iOS 8.1 and above. There are no additional fees to process Apple Pay payments, and the pricing is the same as other card transactions.
Apple Pay is compatible with most PayFort products and features, allowing you to use it in place of a traditional payment form whenever possible. Use it to accept payments for physical or digital goods, donations, subscriptions, and more.
Apple Pay is available to cardholders at participating banks in supported countries. Refer to Apple’s participating banks documentation to learn which banks and countries are supported.
Endpoints
Sandbox
POST https://sbpaymentservices.payfort.com/FortAPI/paymentApi
Live
POST https://paymentservices.payfort.com/FortAPI/paymentApi
Before you start
Before you get started with Apple Pay, you will need the following:
- An Apple Developer account. Sign up for one here and complete the Apple Pay certification (export the payment processing certificate in p12 file)
- A domain with a valid SSL certificate (meaning your domain should start with
https
). - Access to a Secure Shell (SSH) terminal.
- Access to your server's files, so you can upload files to your server.
- Integrate Apple Pay in your app/website using the Apple Pay documentation found at https://developer.apple.com/apple-pay
- Submit the encrypted Apple Pay payload to PayFort’s API for decryption / processing. Please contact integration@payfort.com for PayFort’s integration documentation
Configure Apple Pay
- Create your merchant IDs in your Apple Pay Developer account
Placeholder: Sample video showing how to create merchant Ids in Apple Pay Developer account.
-
Integrate Apple Pay in your app/website using the Apple Pay documentation found at https://developer.apple.com/apple-pay
-
Submit the encrypted Apple Pay payload to PayFort’s API for decryption / processing. Please contact integration@payfort.com for PayFort’s integration documentation
Parameters Submission Type
REST POST request using JSON.
The ApplePay Request
Placeholder: Insert sample request code for apple pay
The ApplePay Response
Here is the sample response
Placeholder: Please insert sample response for Apple Pay Service as sent by PayFORT server.
Apple Pay SDK Service
Apple Pay is a digital wallet that allows your customers to make payments using different Apple devices via FORT iOS SDK. The Customer authenticate his identity with Touch ID fingerprint verification to complete the payment.
Before You Start
• You will need one of these iOS devices (iPhone 6, iPhone 6s, iPhone 6 Plus, iPhone 6s Plus, iPhone 7, iPhone 7 Plus, iPhone SE, iPad Air 2, iPad mini 3, iPad mini 4, and iPad Pro models) running iOS 8.1 or later.
• You will need a Mac with Xcode 6.1 or newer installed. You can install or upgrade Xcode in the Mac App Store.
• You will also need an apple developer account and a membership in the iOS Developer Program. You can create a one from here.
• You will need to download the FORT iOS Mobile SDK, click here.
Get Started
Before you start Apple Pay integration with PayFort please refer to the following URL here to complete the following steps:
-
Setup your Apple Pay account.
-
Complete the integration with Apple Pay SDK.
-
After completing the integration with Apple Pay, check that you have got the following: • Apple merchantID. • Merchant certificate. • Payment processing certificate. Then copy the following sample code to complete integration with FORT Mobile SDK:
Object-C code for Integration with PayFORT iOS SDK
```objective-c #pragma mark - PKPaymentAuthorizationViewControllerDelegate
(void)paymentAuthorizationViewController: (PKPaymentAuthorizationViewController )controller didAuthorizePayment:(PKPayment )payment completion:(void (^)(PKPaymentAuthorizationStatus status))completion { BOOL asyncSuccessful = payment.token.paymentData.length != 0;
if(asyncSuccessful) {
PayFortController *payFort = [[PayFortController alloc]initWithEnviroment:(KPayFortEnviroment)_enviromentSegment.selectedSegmentIndex];
NSMutableDictionary *request = [[NSMutableDictionary alloc]init]; [request setValue:@“10000” forKey:@“amount”]; [request setValue:@“AUTHORIZATION” forKey:@“command”]; [request setValue:@“USD” forKey:@“currency”]; [request setValue:@“email@domain.com” forKey:@“customer_email”]; [request setValue:@“en” forKey:@“language”]; [request setValue:@“merchant” forKey:@“merchant_reference”]; [request setValue:@“” forKey:@“sdk_token”]; [request setValue:@“APPLE_PAY” forKey:@“digital_wallet”];
[payFort callPayFortForApplePayWithRequest:request applePayPayment:payment currentViewController:self Success:^(NSDictionary requestDic, NSDictionary responeDic) { completion(PKPaymentAuthorizationStatusSuccess);
} Faild:^(NSDictionary requestDic, NSDictionary responeDic, NSString *message) { completion(PKPaymentAuthorizationStatusFailure);
}]; } else { completion(PKPaymentAuthorizationStatusFailure); } } ```
Swift Code for Integration with PayFORT iOS SDK
func paymentAuthorizationController(_ controller: PKPaymentAuthorizationController,
didAuthorizePayment payment: PKPayment, completion: @escaping (PKPaymentAuthorizationStatus) -> Void) {
//Perform some very basic validation on the provided contact information
let asyncSuccessful = payment.token.paymentData.count != 0
if asyncSuccessful {
let payFort = PayFortController.init(enviroment: KPayFortEnviromentSandBox)
let request = NSMutableDictionary.init()
request.setValue(“100100000”, forKey: “amount”)
request.setValue(“AUTHORIZATION”, forKey: “command”)
request.setValue(“USD”, forKey: “currency”)
request.setValue(“email@domain.com”, forKey: “customer_email”)
request.setValue(“en”, forKey: “language”)
request.setValue(“merchant”, forKey: “merchant_reference”)
request.setValue(“gr66zzwW9” , forKey: “sdk_token”)
request.setValue(“APPLE_PAY” , forKey: “digital_wallet”)
payFort?.callPayFortForApplePay(withRequest: request,
applePay: payment,
currentViewController: self
, success: { (requestDic, responeDic) in
completion(.success)
}, faild:{ (requestDic, responeDic, message) in
completion(.failure)
})
}else {
completion(.failure)
}
}
Apple Pay SDK Authorization/ Purchase - Request
Placeholder: Sample code for Apple Pay SDK Authorization/Purchase - Request
Apple Pay SDK Authorization/ Purchase - Response
Placeholder: Sample code for Apple Pay SDK authorization/Purchase Response in JSON format
Test Your Wallet Integration
You can checkout this link for testing your wallet integration
Go to Full API
Check out our full API by visiting this link
Need further help?
Thanks for using PayFort.com. If you need any help or support, then message our support team at support@payfort.com.