Skip to content

Commit

Permalink
Applied third round of documentation copying after rebasing on master.
Browse files Browse the repository at this point in the history
(See 410d4a5)
  • Loading branch information
Pimm committed Jan 28, 2021
1 parent 7b9a99b commit 580a779
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
23 changes: 23 additions & 0 deletions src/resources/applePay/ApplePayResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ import renege from '../../plumbing/renege';
export default class ApplePayResource {
constructor(protected readonly networkClient: NetworkClient) {}

/**
* For integrating Apple Pay in your own checkout on the web, you need to [provide merchant
* validation](https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/providing_merchant_validation). This is normally done using Apple's [Requesting Apple Pay
* Session](https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/requesting_an_apple_pay_payment_session). The merchant validation proves (to Apple) that a validated
* merchant is calling the Apple Pay Javascript APIs.
*
* When integrating Apple Pay via Mollie, you cannot call Apple's API but you should call this API instead. The response of this API call should be passed as-is to the the completion method,
* [completeMerchantValidation](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778015-completemerchantvalidation).
*
* Before requesting an Apple Pay Payment Session, you must place the [domain validation file](http://www.mollie.com/.well-known/apple-developer-merchantid-domain-association) 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.
*
* The guidelines for working with a payment session are:
*
* - Request a new payment session object for each transaction. You can only use a merchant session object a single time.
* - The payment session object expires five minutes after it is created.
* - Never request the payment session from the browser. The request must be sent from your server.
*
* For the full documentation, see the official [Apple Pay JS API](https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api) documentation.
*
* @since 3.5.0
* @see https://docs.mollie.com/reference/v2/wallets-api/request-apple-pay-payment-session
*/
public requestPaymentSession(parameters: RequestPaymentSessionParameters): Promise<ApplePaySession>;
public requestPaymentSession(parameters: RequestPaymentSessionParameters, callback: Callback<ApplePaySession>): void;
public requestPaymentSession(parameters: RequestPaymentSessionParameters) {
Expand Down
12 changes: 9 additions & 3 deletions src/resources/applePay/parameters.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
export interface RequestPaymentSessionParameters {
/**
* The validationUrl you got from the ApplePayValidateMerchant event
* https://developer.apple.com/documentation/apple_pay_on_the_web/applepayvalidatemerchantevent
* The `validationUrl` you got from the [ApplePayValidateMerchant event](https://developer.apple.com/documentation/apple_pay_on_the_web/applepayvalidatemerchantevent).
*
* A [list of all valid host names](https://developer.apple.com/documentation/apple_pay_on_the_web/setting_up_your_server#3172427) for merchant validation is available. You should white list these
* in your application and reject any `validationUrl` that have a host name not in the list.
*
* @see https://docs.mollie.com/reference/v2/wallets-api/request-apple-pay-payment-session?path=validationUrl#parameters
*/
validationUrl: string;
/**
* The domain of your web shop, that is visible in the browser’s location bar. For example pay.myshop.com.
* The domain of your web shop, that is visible in the browser's location bar. For example `pay.myshop.com`.
*
* @see https://docs.mollie.com/reference/v2/wallets-api/request-apple-pay-payment-session?path=domain#parameters
*/
domain: string;
}

0 comments on commit 580a779

Please sign in to comment.