AlliancePay
🇬🇧 English
🇬🇧 English
  • E Commerce platform AlliancePay v2.32.0
  • Authentication
  • Data Encryption
  • Authorization
  • Using an authorization token
  • Key Management Overview
    • PURCHASE Collection Example
    • A2C Collection Example
  • Payment methods H2H
    • PURCHASE
      • PURCHASE Request - Step 1
      • PURCHASE Request - Step 2
    • A2C
    • C2A
      • C2A Transaction Request - Step 1
      • C2A Transaction Request - Step 2
    • ApplePay decrypted
      • PURCHASE
        • Payment Processing Request - Step 1
        • Payment Processing Request - Step 2 (3DS)
      • C2A
        • C2A request Step 1
        • C2A request Step 2 (3DS)
    • ApplePay encrypted
      • Request aPay support on the page
      • Request to receive aPay merchant data
      • Merchant validation request
      • Session Establishment Request in aPay
      • Payment Processing Request
    • GooglePay™ decrypted
      • PURCHASE
        • Payment Processing Request - Step 1
        • Payment Processing Request - Step 2 (3DS)
      • C2A
        • C2A request Step 1
        • C2A request Step 2 (3DS)
    • GooglePay™ encrypted
      • Google Pay™ Documentation
      • Google Pay™ Support Request on the Page
      • Google Pay™ Merchant Data Retrieval Request
      • Payment request
    • REFUND
    • TOKEN
      • PURCHASE
        • Token payment request Step 1
        • 3DS token payment request Step 2
      • C2A
        • Token payment request Step 1
        • 3DS token payment request Step 2
      • Token Creation
      • Retrieve Token by CustomerId
      • Retrieve Token Data
      • Update Token Status
      • Token Statuses
    • Account Verification
      • Card Verification Request Step 1
      • Card verification request Step 2
    • Getting data
      • By OPERATION_ID
      • By merchantRequestId
    • Getting a balance
    • Callback
  • Payment methods HPP
    • PURCHASE
      • Creating an order
      • Receiving order data
    • REFUND
    • Callback
    • Order statuses
  • Dictionary
    • Transaction status
    • Test cases
    • Error codes
    • Value actionCode, responseCode
    • Limits
    • Instructions for reconciliation by registers
      • Fields Description in Registers
    • Whitelist IP addresses and URLs
  • History of changes
Powered by GitBook
On this page
  1. Payment methods H2H
  2. ApplePay encrypted

Merchant validation request

Request through a proxy server to the apple pay server to receive merchant validation

fetchAppleSessionAPI and purchaseApplePayAPI - functions that call the API, use your functions to work with the API, or fetch An example of an ApplePay payment button click event handler is described below:


const onApplePayButtonClicked = async () => {
    // Additional check whether the browser supports Apple Pay
    if (!window.ApplePaySession) {
      return;
    }
    
    // An object to create a session
    const request = {
      countryCode: 'UA', 
      currencyCode: 'UAH',
      merchantCapabilities: ['supports3DS'],
      supportedNetworks: ['visa', 'masterCard'],
      total: {
        label: 'PoC Merchant Apple Pay', // merchant name
        type: 'final',
        amount: amount.toString(), // transaction amount
      },
    };

    // Creating a session
    const session = new window.ApplePaySession(3, request);

    session.onvalidatemerchant = async (event: any) => {
      try {
        // Call request to create a session сесії https://docs.merchant.alb.ua/platizhni-metodi-h2h/applepay-encrypted/zapit-vstanovlennya-sesiyi-v-apau
        const response = await fetchAppleSessionAPI(event.validationURL, applePayMercantId, { deviceId, refreshToken });

        session.completeMerchantValidation(response.applePaySessionData);
      } catch (error) {
        // error handling of a request to create a session
      }
    };

    session.onshippingmethodselected = () => {
      const newTotal = {
        label: 'PoC Merchant Apple Pay', // merchant name
        type: 'final',
        amount: amount.toString(), // transaction amount
      };
      session.completeShippingMethodSelection(window.ApplePaySession.STATUS_SUCCESS, {}, newTotal);
    };

    // event when the user has successfully selected a card for payment
    session.onpaymentauthorized = async (event: any) => {

      const result = {
        status: window.ApplePaySession.STATUS_SUCCESS,
      };
      
      session.completePayment(result);
      
      try {
        // payment request call https://docs.merchant.alb.ua/platizhni-metodi-h2h/applepay-encrypted/zapit-provedennya-platezhu
        const response = await purchaseApplePayAPI(
          {
            paymentToken: event.payment.token,
            // other data required for the call
            
          }
          { deviceId, refreshToken, serverPublicKey }
        );
        
      } catch (error) {
         // payment request error error
      }
    };

    session.begin();
  };
PreviousRequest to receive aPay merchant dataNextSession Establishment Request in aPay

Last updated 2 months ago