Hello,
1. You should use a code like this:
cart.PaymentGatewayCustomData[AuthorizeNetParameters.CARD_NUMBER] = txtCreditCardNumber.Text;
instead of:
cart.PaymentGatewayProvider.PaymentGatewayCustomData[AuthorizeNetParameters.CARD_NUMBER] = txtCreditCardNumber.Text;
2. You should create an order before payment process.
Before the code:
provider.ProcessCustomData();
provider.ProcessPayment();
you could insert a code like this:
// Create and initialize new order
OrderInfo oi = new OrderInfo();
oi.OrderCustomerID = ShoppingCartInfoObj.ShoppingCartCustomerID;
oi.OrderCompletedByUserID = ShoppingCartInfoObj.ShoppingCartUserID;
oi.OrderCurrencyID = ShoppingCartInfoObj.ShoppingCartCurrencyID;
oi.OrderDate = DateTime.Now;
oi.OrderBillingAddressID = ShoppingCartInfoObj.ShoppingCartBillingAddressID;
oi.OrderPaymentOptionID = ShoppingCartInfoObj.ShoppingCartPaymentOptionID;
oi.OrderShippingAddressID = ShoppingCartInfoObj.ShoppingCartShippingAddressID;
oi.OrderShippingOptionID = ShoppingCartInfoObj.ShoppingCartShippingOptionID;
oi.OrderSiteID = ShoppingCartInfoObj.ShoppingCartSiteID;
oi.OrderNote = txtNote.Text.Trim();
oi.OrderDiscountCouponID = ShoppingCartInfoObj.ShoppingCartDiscountCouponID;
oi.OrderCompanyAddressID = ShoppingCartInfoObj.ShoppingCartCompanyAddressID;
oi.OrderCustomData.LoadData(ShoppingCartInfoObj.ShoppingCartCustomData.GetData());
OrderStatusInfo osi = OrderStatusInfoProvider.GetFirstEnabledStatus();
oi.OrderStatusID = (osi != null) ? osi.StatusID : 0;
oi.OrderTotalPrice = ShoppingCartInfoObj.RoundedTotalPrice;
oi.OrderTotalShipping = ShoppingCartInfoObj.TotalShipping;
oi.OrderTotalTax = ShoppingCartInfoObj.TotalTax;
try
{
OrderInfoProvider.SetOrderInfo(oi);
oi.OrderInvoiceNumber = oi.OrderID.ToString(); //.PadLeft(8, '0');
OrderInfoProvider.SetOrderInfo(oi);
// Create and initialize order items
foreach (ShoppingCartItemInfo item in ShoppingCartInfoObj.CartItems)
{
if (item.SKUObj != null)
{
OrderItemInfo oii = new OrderItemInfo();
oii.OrderItemSKUID = item.SKUID;
oii.OrderItemOrderID = oi.OrderID;
oii.OrderItemSKUName = item.SKUObj.SKUName;
oii.OrderItemUnitCount = item.CartItemUnits;
oii.OrderItemUnitPrice = item.SKUObj.SKUPrice;
oii.OrderItemCustomData.LoadData(item.CartItemCustomData.GetData());
oii.OrderItemGUID = item.CartItemGUID;
oii.OrderItemParentGUID = item.CartItemParentGUID;
try
{
OrderItemInfoProvider.SetOrderItemInfo(oii);
}
catch (Exception ex)
{
OrderInfoProvider.DeleteOrderInfo(oi.OrderID);
throw ex;
}
}
}
This is a core which should work.
Best regards,
Helena Grulichova