Skip to content

Latest commit

 

History

History
87 lines (66 loc) · 6.77 KB

File metadata and controls

87 lines (66 loc) · 6.77 KB

Wallets

Overview

Available Operations

RequestApplePaySession

When integrating Apple Pay in your own checkout on the web, you need to provide merchant validation. This is normally done using Apple's Requesting an Apple Pay Session. The merchant validation proves to Apple that a validated merchant is calling the Apple Pay Javascript APIs.

To integrate Apple Pay via Mollie, you will have to call the Mollie API instead of Apple's API. The response of this API call can then be passed as-is to the completion method, completeMerchantValidation.

Before requesting an Apple Pay Payment Session, you must place the domain validation file on your server at: https://[domain]/.well-known/apple-developer-merchantid-domain-association. Without this file, it will not be possible to use Apple Pay on your domain.

Each new transaction requires a new payment session object. Merchant session objects are not reusable, and they expire after five minutes.

Payment sessions cannot be requested directly from the browser. The request must be sent from your server. For the full documentation, see the official Apple Pay JS API documentation.

Example Usage

package main

import(
	"context"
	"os"
	"github.com/mollie/mollie-api-golang/models/components"
	client "github.com/mollie/mollie-api-golang"
	"github.com/mollie/mollie-api-golang/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := client.New(
        client.WithSecurity(components.Security{
            APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
        }),
    )

    res, err := s.Wallets.RequestApplePaySession(ctx, client.Pointer("123e4567-e89b-12d3-a456-426"), &operations.RequestApplePayPaymentSessionRequestBody{
        ValidationURL: "https://apple-pay-gateway-cert.apple.com/paymentservices/paymentSession",
        Domain: "pay.myshop.com",
        ProfileID: client.Pointer("pfl_5B8cwPMGnU"),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.EntitySession2 != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
idempotencyKey *string A unique key to ensure idempotent requests. This key should be a UUID v4 string. 123e4567-e89b-12d3-a456-426
requestBody *operations.RequestApplePayPaymentSessionRequestBody N/A
opts []operations.Option The options for this request.

Response

*operations.RequestApplePayPaymentSessionResponse, error

Errors

Error Type Status Code Content Type
apierrors.ErrorResponse 422 application/hal+json
apierrors.APIError 4XX, 5XX */*