//native
type Mollie = {
token: string;
};
/**
* Request Apple Pay payment session
* When integrating Apple Pay in your own checkout on the web, you need to [provide merchant validation](https://developer.
*/
export async function main(
auth: Mollie,
body: { validationUrl: string; domain: string; profileId?: string },
) {
const url = new URL(`https://api.mollie.com/v2/wallets/applepay/sessions`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 428 days ago