What are the Slack Archives?
Itβs a history of our time together in the Slack Community! Thereβs a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you wonβt be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hi everyone, anyone knows how to activate the multiple payments for a checkout? I'm sending two paym
Hi everyone, anyone knows how to activate the multiple payments for a checkout?
I'm sending two payments in the checkout
"payments": [
{
"paymentMethodName": "efectivo",
"paymentProviderName": "Dupplo Payment",
"paymentSelection": "efectivo"
},
{
"paymentMethodName": "tarjeta",
"paymentProviderName": "Dupplo Payment",
"paymentSelection": "tarjeta"
}
],
But I'm getting this error:
{
"errors": [
{
"status": 400,
"code": "1107",
"detail": "Multiple payments are not allowed."
}
]
}
Any help will be appreciated, thanks
Comments
-
For letting this request pass through, you need to unwire the
SinglePaymentCheckoutRequestAttributesValidatorPlugin
from the\Pyz\Glue\CheckoutRestApi\CheckoutRestApiDependencyProvider::getCheckoutRequestAttributesValidatorPlugins
0 -
I'll try this, thanks
0 -
Hi, did you know how to split the grand total between the two payments? because it's taking the total in the first payment and ignoring the second one.
0 -
Good morning @U01UHQE5Z27
Splitting the order payment between two or more payment providers can be done at the Calculation step. You can have a look at the way spryker core manages the gift card payments: the
GiftCardCalculatorPlugin
creates and adds to quote aPaymentTransfer
that hasamount
set. This amount is equal to the gift card value. The rest of the total (if any) will be payed by the second payment provider (PaymentCalculatorPlugin
).This logic can be modified to suite any workflow the project needs. For example, you can choose to let customer select the amount he/she want to pay with each payment method (and accept the amount values from the API input). Another option will be to do a 50/50 split. This heavily depends on your project requirements.
0 -
Hi, good morning, let me check this, thank you so much.
0 -
Hi @UQKSAARKN I'm trying to do this ("and accept the amount values from the API input") as you commented, but I'm super lost and don't know how to change or make this possible, normally I use the CheckoutRestApi to place an order, this request get the payment in "RestPaymentTransfer" which does not have amount in the properties, how can I change and overrides this? Can you give some guidance please?
0 -
Hi Daniel.
Adding properties to the
RestPaymentTransfer
on the project level should work. If you do:<transfer name="RestPayment"> <property name="amount" type="int" restRequestParameter="required"/> </transfer>
It should allow you to accept one additional field in the
data.attributes.payments.$index.amount
.If this works, then check if the mapping of the REST attribute to the
PaymentTransfer
is correct in the\Spryker\Zed\PaymentsRestApi\Communication\Plugin\CheckoutRestApi\PaymentsQuoteMapperPlugin
. Of course you want the automatic mapping to work, the property in thePaymentTransfer
should be named the same:<transfer name="Payment"> <property name="amount" type="int"/> </transfer>
If you need to modify this (map to a different property in the
QuoteTransfer
, then you create an additional (or replacement) for thePaymentsQuoteMapperPlugin
(implement\Spryker\Zed\CheckoutRestApiExtension\Dependency\Plugin\QuoteMapperPluginInterface
and do whatever you need with the data inQuoteTransfer
).Let me know if this helps π
0 -
Thanks, let me try this
0 -
Hi @UQKSAARKN sorry to bother you, I made the changes and now I can set the amount for a payment, but still the checkout only takes 1 payment, do you have an idea what is happening?
I removed the SinglePaymentCheckoutRequestAttributesValidatorPlugin.
I'm sending two payments in the checkout
In zed only one payment is persisted
0 -
-
I can only help by asking questions here. Please bear with me.
1. Does you payment data reach Zed layer? Are you able to debug this?
2. Does you Payment provider implementation know how to handle two payments? Does each payment method know that it only needs to handle the amount it is assigned to handle? This is project level implementation because I do not recognize the payment method name you are using; this is why itβs difficult to say what is wrong exactly.0 -
Hi
- I don't know if both payment reach the Zed layer. I don't have my installation setup ready for debugging.
- I don't have any special implementarion on the payment providers, let me explain how we do this.
We only load the two payments in payment-methods import.
Then we assign these payment to the same OMS process and that's all, we don't implement nothing more, I tried assigning diferents OMS process for each payment but I got the same result.
0 -
hi! There must be an implementation of a PSP handling underneath, otherwise your orders will not get anything but the payment provider and method name. You can look at what other PSP modules are doing for checkout in order to understand what your PSP needs.
Form what I see in the code, all payment methods must be saved by the
SalesPaymentCheckoutDoSaveOrderPlugin
, so the another problem happens even earlier and your payments DO NOT reach Zed.This looks like there is need to debug the whole process.
0 -
Thanks, I'm checking this right now, If I have more questions I'll let you know
0 -
Hi Eugenia,
I found this PaymentsQuoteMapperPlugin used in getQuoteMapperPlugin in CheckoutRestApiDependencyProvider
This mapper has this code (see image)
If I understand well, this code is taking only the first payment and ignore the rest, so this is my problem right?
0 -
Yes, this looks like a mapping issue reason.
0 -
Can I override this behaviour??
0 -
You can replace the plugin. Unwire the one doing single payment and a new one.
0 -
Ok, got it, thank you so much, and sorry for so much trouble xD
0 -
No problem at all. Itβs a pity there is so much time diff between us. I hope you get it working
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 69 Spryker News
- 899 Developer Corner
- 760 Spryker Development
- 83 Spryker Dev Environment
- 361 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 24 Job Opportunities
- 3.2K π Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 68 Spryker Safari Questions
- 50 Random