Issue with creating new Payment Plugin

один месяц назад
Hello everyone,
I've created a payment plugin in nop 4.6. at this point I need to save attributes for order but order is not yet saved in DB ( proccess Payment). Getting order by guid returns null. What should I do? I tried to do like PayPal but I got confused and it always return null for order.
один месяц назад
There is no order to get. The order is created later.
One way is to temporarily save the attributes as generic attributes the add them to the order when it is created i.e. use PostPaymentProcess
один месяц назад
hshadmehr wrote:
Hello everyone,
I've created a payment plugin in nop 4.6. at this point I need to save attributes for order but order is not yet saved in DB ( proccess Payment)


The process Payment (used by on-site payment) method executes before an order is placed while the PostProcess (used by redirection payment methods) method executes after an order is placed so you can get the order by the GUID only in the PostProcess method.

What attribute are you trying to save? The checkout attributes and the selected product attributes are automatically saved when the order is placed in the Order and the OrderItem tables respectively.
один месяц назад
Yidna wrote:
There is no order to get. The order is created later.
One way is to temporarily save the attributes as generic attributes the add them to the order when it is created i.e. use PostPaymentProcess


I want to do that but  saving attributes needs an entity to use it for getting the attribute next.
один месяц назад
sanju.dahal741 wrote:
Hello everyone,
I've created a payment plugin in nop 4.6. at this point I need to save attributes for order but order is not yet saved in DB ( proccess Payment)

The process Payment (used by on-site payment) method executes before an order is placed while the PostProcess (used by redirection payment methods) method executes after an order is placed so you can get the order by the GUID only in the PostProcess method.

What attribute are you trying to save? The checkout attributes and the selected product attributes are automatically saved when the order is placed in the Order and the OrderItem tables respectively.



Api send me back a transactionId and two tokens for each request. And I have to keep them and use them until the end of payment proccess, all.
один месяц назад
hshadmehr wrote:

Api send me back a transactionId and two tokens for each request. And I have to keep them and use them until the end of payment proccess, all.


In this case, you can use the session. Something like this

HttpContext.Session.Set("yourSessionName", yourSessionValue);


Move it to the order from the postProcess method and clear the session when done.
один месяц назад
As mentioned above, Generic Attributes can be used to save temporary values.  Use the customer as the entity.  See example

\Plugins\Nop.Plugin.Payments.CyberSource\CyberSourcePaymentMethod.cs

await _genericAttributeService.SaveAttributeAsync(customer, CyberSourceDefaults.PaymentWithNewCardAttributeName, isNewCard, store.Id);
один месяц назад
I can help you in this.
4 недели назад
New York wrote:
As mentioned above, Generic Attributes can be used to save temporary values.  Use the customer as the entity.  See example

\Plugins\Nop.Plugin.Payments.CyberSource\CyberSourcePaymentMethod.cs

await _genericAttributeService.SaveAttributeAsync(customer, CyberSourceDefaults.PaymentWithNewCardAttributeName, isNewCard, store.Id);



If a customer has more than one order in proccess to pay, doesnt it make any ptoblem?
4 недели назад
And I have another Question. When PostProcessPayment is called and when ProcessPayment?

I tried to use PostProcessPayment But I got an error "data buffer is null"