var invoiceService = MerchelloContext.Current.Services.InvoiceService;
var customerContext = new CustomerContext(UmbracoContext.Current);
var basket = customerContext.CurrentCustomer.Basket();
var preparation = basket.SalePreparation();
var invoice = preparation.PrepareInvoice();
invoiceService.Save(invoice);
IPaymentMethod paymentMethod=preparation .GetPaymentMethod();
var paymentResult = invoice.AuthorizePayment(paymentMethod.Key);
if (paymentResult.Payment.Result.ExtendedData != null && paymentResult.Payment.Result.ExtendedData.ContainsKey("RedirectUrl"))
{
string orderConfirmUrl = paymentResult.Payment.Result.ExtendedData.GetValue("RedirectUrl");
//here redirect to orderConfirmUrl
}
If you want to send the confirmation notification you can write:
Payment plugin implementation depends of SaferPay rules.
For example in payPal, when you request a new payment, you have to add a "returnUrl" param for success or not success payment.
You can listen the payment notification creating an UmbracoApiController like this:
[PluginController("MerchelloPayPal")]
public class PayPalApiController : UmbracoApiController
{
[HttpGet]
public HttpResponseMessage SuccessPayment(Guid invoiceKey, Guid paymentKey, string token, string payerId)
{
//your implementation
}
[HttpGet]
public HttpResponseMessage AbortPayment(Guid invoiceKey, Guid paymentKey, string token, string payerId = null)
{
//your implementation
}
}
Merchello and SaferPay
Hi.
I need some help for the saferpay payment provider. The process should look like:
Is there an example for this postback process?
I dont know how the PaymentGatewayProvider and gatewaymethod should look like and how i redirect to the saferpay.
Thanks for your help.
The SaferPay workflow seems to be similar to the payPal workflow.
You can view the paypal plugin code at: https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Payments/PayPal/src/Merchello.Plugin.Payments.PayPal
Okay if so:
thanks for your help!
This is my confirmation method:
If you want to send the confirmation notification you can write:
Payment plugin implementation depends of SaferPay rules.
For example in payPal, when you request a new payment, you have to add a "returnUrl" param for success or not success payment. You can listen the payment notification creating an UmbracoApiController like this:
Hi!
I came a lot furthur with your help!
I still have some issues. I cannot figure out how to change the payment status from unpaid to paid...
i've uploaded my code to github.
Thanks again!
EDIT: I have now a working solution.
is working on a reply...