@andrea-alfanet wrote:
Hello,
I am trying to create multi stores where different merchants should sell their products and each merchant must use his own PayPal account.
I would like to jump in the PayPal form with checkout data and merchant id as well in order to get the payment in the correct merchant id for each store.In a desktop web site I used the below action post for each merchant and it works fine:
action: “https://www.paypal.com/it/cgi-bin/webscr”
param1: name=business and value=“xxxxxxx”
param2: …
etc…In ionic3 I’m trying to use a new PayPal javascript sdk.
1 - I call my client ID in the index.html header as below:
2 - In the PayPal button I tried to pass the merchant id of each store in the payee command but PayPal, but I get an error: Pass merchant-id=“XYZ” in the PayPal script tag. Pass merchant-id=unknown if you do not have access to the merchant id. Obviously I have the merchant id that I pass in the payee command as you can see in the below script. Where am I wrong?below my button script:
initPayPal() { var _totaleOrdine = this.totaleOrdine.toString(); var _merchant: string = 'XXXXXXXXX'; paypal.Buttons({ env: 'sandbox', // sandbox | production locale: 'it_IT', //ref: https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/customize-button/ style: { size: 'responsive', color: 'gold', shape: 'pill', label: 'buynow', // label: checkout, buynow, credit, pay, paypal tagline: false }, commit: true, debug: true, createOrder: function(data, actions) { // Set up the transaction console.log(data); console.log(actions); return actions.order.create({ application_context: { brand_name: "MyBrand", }, purchase_units: [{ // reference_id:_merchant, amount: { value: _totaleOrdine, }, payee: { email: 'merchant2@mydomain.it', merchant_id: 'xxxxx' }, shipping: { address: { address_line_1: "Via Roma 10", address_line_2: "", admin_area_2: "Roma", admin_area_1: "RM", postal_code: "00100", country_code: "IT", }, name:{ full_name: "adam adami" }, }, }], }); }, onApprove: function(data, actions) { return actions.order.capture().then(function(details) { alert('Transaction completed by ' + details.payer.name.given_name); console.log(details); // Call your server to save the transaction return fetch('/paypal-transaction-complete', { method: 'post', body: JSON.stringify({ orderID: data.orderID }) }); // }); }, onCancel: function(data, actions) { /* * Buyer cancelled the payment */ console.log("Buyer cancelled the payment"); }, onError: function(err) { /* * An error occurred during the transaction */ console.log(err); console.log("An error occurred during the transaction"); } }).render(this.paypalbuttoncontainer2);
Posts: 1
Participants: 1