Home » Developing » Developing in Litium Studio » Litium Studio ECommerce » Payment provider » Pass Additional Info
Sometimes it is required to pass additional information into the Payment Provider, which are part of the checkout flow, and which are not normally stored in the order object.
We have two options of passing information to Payment Provider.
- The information can be passed into the payment providers in the ExecutePayment method. The ExecutePayment method receives ExecutePaymentArgs, in which we should have this additional information.
- The information can be stored as additional payment information of the order object, and then access this information inside the payment provider. Inside payment provider methods you can access the order object through the PaymentInfo object
Method 1
This is the method used by the Litium Studio default implementation to pass extra information. This method uses the PaymentInfoArgs object that collects information from the CheckoutFlow. The advantage of this method is, it does not save the information into the database!..There are some information, which are private information which we should not save due to security reasons and privacy laws. If you have such information to be passed to the payment provider, this method should be used. If the information is not privacy or security related, then just use method 2 below which is simple.
We will cover using method 1 in a seperate tutorial in future.
Method 2
The second method above is very simple. You just need to add the information into the additional payment info during your checkout flow implementation. There is an article on how to add additional delivery information and then use that information to calculate the delivery cost here. You can use the same technique for payment providers. Adding additional order information through your checkout flow is shown here. Instead of AdditionalOrderInfo, it is more proper to use AdditionalPaymentInfo in this case. So, just use that.
To access the information you have added, you can use PaymentInfo object from inside the Payment Provider implementation methods. This is because PaymentProvider inherits from PaymentProviderBase class, which provide this functionality. Following code can be executed inside a PaymentProvider implementation method, to iterate through the collection of PaymentInfo.
foreach (AdditionalPaymentInfo additionalInfo in PaymentInfo.AdditionalPaymentInfo)
{
//do something with additional info
}
Comments made
No comments are made
You need to be logged in to make a comment