Through paypal it is possible to create buttons with a dropdown selection.
Example : https://www.paypal.com/ncp/payment/[token]
I am having hard time implementing the same through a session url, as I'd need to also include custom Ids for the whole process, and backend logic.
When creating a normal monthly sub I use:
const response = await fetch('https://api-m.paypal.com/v1/billing/subscriptions', { method: 'POST', headers: { Authorization: `Bearer ${accessToken}`,'Content-Type': 'application/json', }, body: JSON.stringify({ plan_id: 'P-08L0057...', custom_id: `${customId}`, application_context: { brand_name: 'Sub', locale: 'en-US', shipping_preference: 'NO_SHIPPING', user_action: 'SUBSCRIBE_NOW', }, }), }); const data = await response.json(); return data;
Is there a similar way, but to display a dropdown with selectable options instead?Or do I have to make the dropdown myself and then creating an order based on that?
const response = await fetch('https://api-m.paypal.com/v2/checkout/orders', { method: 'POST', headers: { Authorization: `Bearer ${accessToken}`,'Content-Type': 'application/json', }, body: JSON.stringify({ intent: 'CAPTURE', purchase_units: [ { amount: { currency_code: 'EUR', value: '6.75', breakdown: { item_total: { currency_code: 'EUR', value: '6.75' } } },...
The problem with this approach is that it stacks up all the options I'm trying to give.