buckaroo-it / BuckarooSDK_Node

Repository containing the Node.js SDK by Buckaroo
MIT License
1 stars 3 forks source link

BA-460 Research: Hosted page creation via Node SDK seems only limited to one payment method #66

Closed Flowerinno closed 3 months ago

Flowerinno commented 3 months ago

Payment request sample:

const payment = await this.buckaroo
        .method('mastercard')
        .pay({
          amountDebit: price,
          additionalParameters: {},
          description: 'Some orderID - 29.95AUD',
          returnURL: url,
          pushURL: url,
          returnURLCancel: url,
          returnURLError: url,
          servicesSelectableByClient: ['mastercard', 'visa'],
          culture: 'en-US',
        })
        .setHeaders({
          Culture: 'en-US',
        })
        .request();

Here if I use .combine('visa') for example, an active payment method will be the last one used in .combine() chain. servicesSelectableByClient should list selected payment methods, with primary method mastercard selected in .method().

I can't find a reference in the docs and repo how to do this. Would be happy if you could assist me with this. Thanks in advance!

Buckaroo-Rene commented 3 months ago

Hi @Flowerinno ,

Thanks for reaching out about the issue you're experiencing. I've passed this along to a colleague who worked on our Node SDK, and they'll review it. You can expect a reply once they've completed their investigation.

vildanbina commented 3 months ago

If you intend to use more than one payment method on the hosted payment page, I believe that the combine option may not be suitable for your needs.

You can achieve this functionality by utilizing noservice as the method, allowing you to specify the payment methods in servicesSelectableByClient. Additionally, it appears that the continueOnIncomplete value was omitted from your payload. Your code should look something like this:

const payment = await this.buckaroo
    .method('noservice')
    .pay({
        servicesSelectableByClient: ['mastercard', 'visa'],
        continueOnIncomplete: true,
        // ... other parameters
    })
    // other chained method calls
    .request();

Please ensure that all necessary parameters are included for the desired outcome.

Feel free to let us know if you have any further questions.

Flowerinno commented 3 months ago

@vildanbina Was playing with noservice, indeed combined with continueOnIncomplete works great. Thank you!