Payment
Get Payment Methods and Create Payment
Gets a collection of PaymentMethod objects.
Parameters for getting payment methods
| Parameter | Type | Details |
|---|---|---|
| country | Country | Specifying which country defined in Ucommerce, to get the payment methods from |
Parameters for creating a payment
| Parameter | Type | Details |
|---|---|---|
| paymentMethodId | int | The id of the payment method to use for the payment. |
| amount | decimal | The payment amount. This is the current basket order total by default. |
| requestPayment | bool | If the payment should be requested immediately. Set to true by default. |
| overwriteExisting | bool | If the existing payment on the current customer's basket should be overwritten. Set to true by default. |
ICollection<PaymentMethod> paymentMethods = transactionLibrary.GetPaymentMethods();
transactionLibrary.CreatePayment(
paymentMethodId:1,
amount: -1,
requestPayment:false,
overwriteExisting:true);
Request Payments
When you're ready to let the customer proceed to payment, you can use the following snippet.
string url = transactionLibrary.GetPaymentPageUrl(transactionLibrary.GetBasket(false).Payments.First());
System.Web.HttpContext.Current.Response.Redirect(url);
//or return Redirect(url) in MVC