Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Reasons do not work #13

Closed
benjaminpick opened this issue Oct 6, 2016 · 7 comments
Closed

Multiple Reasons do not work #13

benjaminpick opened this issue Oct 6, 2016 · 7 comments
Labels

Comments

@benjaminpick
Copy link

benjaminpick commented Oct 6, 2016

Probably the PHP Library do not format it the way the API likes it to have:

Example Request:

$s = Sofortueberweisung('...');
///...
$s->setReason('Testueberweisung', 'Verwendungszweck', 'p1');
$s->setReason('Testueberweisung2', 'Verwendungszweck2', 'p2');
echo json_encode($s->getParameters());

outputs:

{
   "su":[

   ],
   "amount":56,
   "currency_code":"EUR",
   "sender":{
      "country_code":"DE"
   },
   "p1":{
      "reasons":{
         "reason":[
            "Testueberweisung",
            "Verwendungszweck"
         ]
      }
   },
   "p2":{
      "reasons":{
         "reason":[
            "Testueberweisung2",
            "Verwendungszweck2"
         ]
      }
   },
   "success_url":"...",
   "success_link_redirect":true,
   "abort_url":"...",
   "notification_urls":{
      "notification_url":[
         {
            "@data":"..."
         }
      ]
   }
}

The API returns as error messages:

array(2) {
  [0]=>
  array(3) {
    ["code"]=>
    string(4) "8054"
    ["message"]=>
    string(59) "All products deactivated due to errors, initiation aborted."
    ["field"]=>
    string(0) ""
  }
  [1]=>
  array(3) {
    ["code"]=>
    string(21) "8010.reasons.reason.1"
    ["message"]=>
    string(18) "Must not be empty."
    ["field"]=>
    string(16) "reasons.reason.1"
  }
}
@VasuLief
Copy link
Contributor

VasuLief commented Oct 7, 2016

Hello benjaminpick,

our Api looks for the reasons either in in the xml-root or in the 'su' subtree.
Can you try to skip the third parameter 'p1' or change it to 'su'?

$s->setReason('Testueberweisung', 'Verwendungszweck');

@benjaminpick
Copy link
Author

Oh I see ... so this cannot be used for showing more product details on the payment page. Closing this then.

@wickowicz
Copy link

wickowicz commented Feb 12, 2017

Hello! Can you explain how to initialize more than one product to add to payment in Sofort?
I thought it must be some like:

$Sofortueberweisung->setReason('Testueberweisung', 'Verwendungszweck'); $Sofortueberweisung->setReason('Testueberweisung2', 'Verwendungszweck2');

But it don't works. Give me some help, please.

@VasuLief
Copy link
Contributor

I'm not sure if I understand what you want to achieve. What do you mean by "Product"?

A single banking transaction consists of two reasons.

@wickowicz
Copy link

VasuLief, thank you for your answer.
Look, I use Sofort as one of payment methods in internet store. And when buyer wants to buy more than one product (goods), I thought it can be displayed at Sofort payment page. For example like this:

sofort-example

It shows only one product (goods) at payment page, but if there are more than one product, is it possible to show them all at Sofort payment page? And how can I do it, using SofortLib?

Thanks a lot!

@VasuLief
Copy link
Contributor

Such a feature is not possible right now.
The reasons you set with setReason() are used by the bank as the reason for the transaction and usually contains some sort of identifier that you can use to reconcile that transaction.

@wickowicz
Copy link

VasuLief, okay. Thank you a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants