Closed shakaran closed 8 years ago
Hi @shakaran, sorry for the confusion and lack of examples - we're working on this ;-)
The "pay-in PRE-AUTHORIZED DIRECT" is infact just a red herring and nothing to do with Giropay (just copy/paste from other code) - I've just removed this, but so you know, Sofort/Giropay/Elv are all payin webs, with the PaymentType
="DIRECT_DEBIT" and ExecutionType
="WEB" and you just need to add DirectDebitType
with either GIROPAY, SOFORT or ELV as a value (the parameters do not change depending on which value you choose for this field).
$PayIn = new \MangoPay\PayIn();
$PayIn->CreditedWalletId = $WaletId;
$PayIn->AuthorId = $UserId;
$PayIn->PaymentType = "DIRECTDEBIT";
$PayIn->PaymentDetails = new \MangoPay\PayInPaymentDetailsDirectDebit();
$PayIn->PaymentDetails->DirectDebitType = "SOFORT";//just change this line for ELV or GIROPAY
$PayIn->DebitedFunds = new \MangoPay\Money();
$PayIn->DebitedFunds->Currency = "EUR";
$PayIn->DebitedFunds->Amount = 655;
$PayIn->Fees = new \MangoPay\Money();
$PayIn->Fees->Currency = "EUR";
$PayIn->Fees->Amount = 20;
$PayIn->ExecutionType = "WEB";
$PayIn->ExecutionDetails = new \MangoPay\PayInExecutionDetailsWeb();
$PayIn->ExecutionDetails->ReturnURL = "http://yoursite.com/return/";
$PayIn->ExecutionDetails->TemplateURLOptions = array("PAYLINE"=>"https://www.yoursite.com/template");
$PayIn->ExecutionDetails->Culture = "FR";
$result = $mangoPayApi->PayIns->Create($PayIn);
@hobailey sorry for late reply. Thanks for the example. I test fully your example now, I can work with it, but only for amounts more than 100€ that seems a restriction 001012 error code.
But I don't know if this is the thing that I am looking for. My client wants a tipycal form where they customers can pay a service using his credit card (all implemented until this step), but they want also input the bank details for Sofortüberweisung payment something like:
Pay with Sofortüberweisung
Country of bank <text input>
BIC or BLZ <text input>
IBAN or account <text input>
As far I see in your example, the customer can pay in from SOFORT, but I don't know where fill the bank details for that or if it is really a "bank transfer pay in", but I think that you only support "bank transver pay outs"? Could you give me some clues about this?
@shakaran, firstly I think that you are not using the DebitedFunds.Amount field correctly - it should be in cents (ie if you're using less than "100", it's normal that you're getting an error saying that this is lower than the allowed amount, since this is 1EUR). As for your query regarding the bank account details, Sofort (and Giropay btw) handle the bank details on their respective sites, and Mangopay does not see/deal with them. So you do a normal payin web which gives you a RedirectURL, which you should then send the user to (and on this URL they will be asked to enter their bank details etc), a bit like a payin web card payment.
I was looking to add this Pay-In type and I only found this entry in the API docs. It mentions:
My problem is that I cannot see any example using this in the API Doc or even in the API SDK test.
I only found an aprox example using GIROPAY in tests here but it is a bit confused since you treat like "payment type as CARD" and then you use as "pay-in PRE-AUTHORIZED DIRECT".
But I cannot figure out if changing only:
To:
it will work, or I will need know the specific fields that SOFORT request for make the payin that probably are pretty similar to GIROPAY.
Could you guide me a bit more on how implement this? And probably will be good count with a example in API Docs tests for SOFORT pay-in.