Hello Madhi, The way you have implemented the payment gateway is completely fine. The payment status thing also looks good to me. It all depends on how you have requested a payment gateway to process the transaction. Some payment gateways do direct sale transactions means the amount is debited from the customer's card once the transaction is successful. Another way is to authorize the amount in which payment gateway only authorizes the amount on the customer's card when order is placed into the system. It is not charged on the card yet. Once the order is approved or completed in the system, the system should send another request to the payment gateway to capture the transaction. This time the amount is actually charged on the customer's card.
So if you have requested a direct sale transaction to PayTM, I will recommend you use a "refundPayment" service at the time of cancellation or edits in the order. Kind Regards, -- Pritam Kute On Mon, Sep 14, 2020 at 2:16 PM Madhi Krishnan < [email protected]> wrote: > Hii Pritam. > > I basically followed the ofbiz ecommerce flow .. > Shipping -> Shipping_type -> Payment_method ->final_review_page -> External > Gateway ->Callback Url.. > > Here I am using a gateway Called PAYTM. > So once the user clicks the place Order button on the final review page > ,the request goes to the *processOrder*.. > Here the request get redirects to *checkExternalPayment ,* > So from here the user gets redirected to my External Gateway.. > > Here i have noticed that at this stage the status is set as > PAYMENT_NOT_RECIVED, is that correct? > > Once the user comes back to my site ..i'm processing the gateway's response > and depending on the status i am either *approving *the order or > *cancelling > *the order.. > > Thanks & Regards > Madhi Krishnan > > > > On Fri, Sep 11, 2020 at 2:12 PM Pritam Kute <[email protected] > > > wrote: > > > Hello Madhi, > > > > I believe in general eCommerce workflow, an order cannot be canceled when > > it is shipped or completed. It should always be returned. > > > > If payment is received for the order, it means order is completed in > OFBiz. > > So in that case, you should create a return instead of canceling the > order. > > > > I think there is some confusion in the process which you are following. > Can > > you provide some steps in your system how you are processing the > > fulfillment? > > > > Kind Regards, > > -- > > Pritam Kute > > > > > > On Fri, Sep 11, 2020 at 1:29 PM Madhi Krishnan < > > [email protected]> wrote: > > > > > Hey Pritam > > > > > > So if order is cancelled from back-office application ,then ofbiz seems > > to > > > be invoking only authorized and settled orders, > > > it does not act on payment_recieved .Is that expected? > > > or is it some feature awaiting to be implemented? > > > > > > Thanks & Regards > > > Madhi Krishnan > > > > > > On Fri, Sep 11, 2020 at 11:39 AM Pritam Kute < > > > [email protected]> > > > wrote: > > > > > > > Hello Madhi, > > > > > > > > Happy to know that it helped you. > > > > > > > > In payment integration, the process to get payment done depends on > lots > > > of > > > > things like rules in-country, the payment gateway which you are > using, > > > etc. > > > > > > > > In OFBiz OOTB, the expected payment cycle should be like > > > > 1. Payment authorisation when order is placed into the system by the > > > user. > > > > 2. If an order gets cancelled, payment authorisation is released > > > > 3. If an order is edited, payment is released and re-authorised. > > > > 3. If an order is approved/completed in the system, it captures the > > > amount. > > > > 4. If an order is returned after fulfilment, the payment is refunded. > > > > > > > > For direct sale transaction, your payment is already settled/captured > > in > > > > the gateway. So using releaseOrderPayment is not recommended. You > > should > > > > use refundPayment instead. releaseOrderPayment should only be used > when > > > the > > > > payment is in authorised status, not captured/received. > > > > > > > > Kind Regards, > > > > -- > > > > Pritam Kute > > > > > > > > > > > > On Thu, Sep 10, 2020 at 5:23 PM Madhi Krishnan < > > > > [email protected]> wrote: > > > > > > > > > Hey pritam > > > > > > > > > > Thanks man.. > > > > > I was missing the payment_authorization thing.. > > > > > I did a direct sales_transaction.That's why my status on > > > > > OrderPaymentPreference was PAYMENT_RECIVED. > > > > > > > > > > Do I have to explicitly call the *authOrderPayments* service before > > > > calling > > > > > the gateway? > > > > > If you can share any documentation links about transactions in > ofbiz > > > will > > > > > be helpful.. > > > > > > > > > > Thanks Once again > > > > > Madhi Krishnan > > > > > > > > > > > > > > > On Thu, Sep 10, 2020 at 2:55 PM Pritam Kute < > > > > [email protected] > > > > > > > > > > > wrote: > > > > > > > > > > > Hello Madhi, > > > > > > > > > > > > Now based on the logs which you have shared, I suspect either > > > > > > orderPaymentPreferenceId passed to the custom service is wrong or > > the > > > > > > orderPaymentPreference status is not PAYMENT_AUTHORISED. I hope > you > > > > have > > > > > > done payment authorization while placing the order. If you have > > done > > > a > > > > > > direct sale transaction, then this might not work. > > > > > > > > > > > > Kind Regards, > > > > > > -- > > > > > > Pritam Kute > > > > > > > > > > > > > > > > > > On Thu, Sep 10, 2020 at 2:10 PM Madhi Krishnan < > > > > > > [email protected]> wrote: > > > > > > > > > > > > > Hey pritam .. > > > > > > > Thanks for your response ,I appreciate it. > > > > > > > > > > > > > > I checked the entities that you mentioned above and it looks ok > > to > > > > me. > > > > > > > i'm getting a warning in the console saying no payment > preference > > > was > > > > > > > found.. > > > > > > > > > > > > > > Below are the logs that were generated. > > > > > > > |I| Running Service ECA Service: releaseOrderPayments, > triggered > > by > > > > > rule > > > > > > on > > > > > > > Service: changeOrderStatus > > > > > > > 2020-09-10 13:48:54,303 |jsse-nio-8443-exec-3 > > > |PaymentGatewayServices > > > > > > > |W| No OrderPaymentPreference records available for release > > > > > > > 2020-09-10 13:48:54,304 |jsse-nio-8443-exec-3 > |ServiceDispatcher > > > > > > > |T| Sync service [order/releaseOrderPayments] finished in [2] > > > > > > > milliseconds > > > > > > > > > > > > > > other than that everything looks good in the logs.. > > > > > > > I tried to debug ..and i'm getting the warning from the > service > > > > called > > > > > > " > > > > > > > *releaseOrderPayments*" > > > > > > > Service Implementation Location > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ofbiz-framework/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java > > > > > > > At line 772. > > > > > > > > > > > > > > Thanks and regards > > > > > > > Madhi Krishnan > > > > > > > > > > > > > > On Thu, Sep 10, 2020 at 12:56 PM Pritam Kute < > > > > > > > [email protected]> > > > > > > > wrote: > > > > > > > > > > > > > > > Hello Madhi, > > > > > > > > > > > > > > > > Not sure but can you check if you have associated your custom > > > > method > > > > > > with > > > > > > > > the right ProductStorePaymentSetting? > > > > > > > > > > > > > > > > <ProductStorePaymentSetting > productStoreId="${productStoreId}" > > > > > > > > paymentMethodTypeId="CREDIT_CARD" > > > > > > > > paymentServiceTypeEnumId="PRDS_PAY_REFUND" > > > > > > paymentService="testCCRefund" > > > > > > > > paymentCustomMethodId="CC_REFUND_TEST"/> > > > > > > > > > > > > > > > > You can either put your payment gateway service name in > > > > > paymentService > > > > > > of > > > > > > > > the custom method ID in paymentCustomMethodId field. > > > > > > > > > > > > > > > > It will be good if you can post the error log here if this is > > > not a > > > > > > case. > > > > > > > > > > > > > > > > Kind Regards, > > > > > > > > -- > > > > > > > > Pritam Kute > > > > > > > > > > > > > > > > > > > > > > > > On Thu, Sep 10, 2020 at 4:42 AM Madhi Krishnan < > > > > > > > > [email protected]> wrote: > > > > > > > > > > > > > > > > > Hii community, > > > > > > > > > Hope you all are doing well. > > > > > > > > > > > > > > > > > > I'm using an external Payment gateway in my ecommerce setup > > > ,and > > > > > I'm > > > > > > > able > > > > > > > > > to place orders using an external gateway.. > > > > > > > > > My question is, I'm struggling to call the refund api if > the > > > user > > > > > > > cancels > > > > > > > > > an order line in an order. > > > > > > > > > I have configured the custom_method entity as well.. > > > > > > > > > let me know if I'm missing something.. > > > > > > > > > > > > > > > > > > Thanks & Regards > > > > > > > > > Madhi Krishnan > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
