Git Product home page Git Product logo

Comments (4)

theodorspringwallee avatar theodorspringwallee commented on July 1, 2024 1

Dear PeraDev7

You can do it this way with TransactionPending as a step after the create() and before calling the payment page url:

$transaction = $this->client->getTransactionService()->create($this->spaceId, $transactionPayload);

  $transactionPending = new \Wallee\Sdk\Model\TransactionPending([
      "id" => $transaction->getId(), // id of created transaction
      "version" => 1
  ]);

$transactionPending->setSuccessUrl("https://yourshop.com/order/success.php?transaction_id="
. $transaction->getId());
$transactionPending->setFailedUrl("https://yourshop.com/order/failed.php?transaction_id="
. $transaction->getId());

$this->client->getTransactionService()->update($this->spaceId, $transactionPending); // update created transaction

$redirectionUrl = 
$this->client->getTransactionPaymentPageService()->paymentPageUrl($this->spaceId, $transaction->getId());

Best regards

from php-sdk.

theodorspringwallee avatar theodorspringwallee commented on July 1, 2024

Dear PeraDev7

If you just want the existing data of a transaction on the success page, I recommend you to pass the transaction ID to the success page and read from there the transaction:

// e.g. Success URL: www.your-shop.com/order/successful?transaction_id=5
$transactionId = htmlspecialchars($_GET['transaction_id']);
$transaction = $apiClient->getTransactionService()->read($spaceId, $transaction->getId());
// with e.g. $transaction->getBillingAddress()->getFamilyName(); you can get then the data out of it

But it can take longer till the transition between authorize to fulfill is done (for example in deferred mode for credit cards).
This information will be transmitted via Webhooks to your shop system.

The URL you define for your Webhooks needs to have a script behind, that is fetching each incoming request (Webhook) from the wallee portal.

Workaround to get transaction updates by Webhooks:

  1. First, the client uses a URL with the destination address where he wants to receive the webhooks (to test you can use Webhook.site): https://app-wallee.com/s/your-space/webhook/url/list
    image

  2. Then the client creates a listener with the type "Transaction" and with the statuses at which the webhooks should be sent: https://app-wallee.com/s/your-space/webhook/listener/list
    image

  3. At the defined target URL of the customer, the customer can intercept the webhooks. There is the entity ID (transaction ID included).

  4. To get the transaction status and other transaction information, the customer must call the following method with the entity and space ID: https://app-wallee.com/api/client/transaction-service--read

Does this answer your questions?

Best regards

from php-sdk.

PeraDev7 avatar PeraDev7 commented on July 1, 2024

Thank you
I wanted to opt for inserting the transaction ID in the success url, but from what I see it is not possible, because the ID is accessible only after creating the transaction, right?

$transactionPayload->setSuccessUrl($urlSuccess);
$transactionPayload->setLineItems(array($lineItem));
$transactionPayload->setAutoConfirmationEnabled(true);
$transaction = $client->getTransactionService()->create($spaceId, $transactionPayload);
$redirectionUrl = $client->getTransactionPaymentPageService()->paymentPageUrl($spaceId, $transaction->getId());

Am i wrong? I'm stucked here. How can i get the ID before? Thanks

from php-sdk.

PeraDev7 avatar PeraDev7 commented on July 1, 2024

Thank you!

from php-sdk.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.