Skip to content

Intent Authorization ignored #41

@Tolfus-Dev

Description

@Tolfus-Dev

Hello there,
i have currently the problem that my passed intent for just authorization of payment (not capture it) is ignored.
For source i have used the official Paypal-Developer-Page: https://developer.paypal.com/studio/checkout/standard/integrate

Currently i have the following code (simplified):
<script type="text/javascript" src="https://www.paypal.com/sdk/js?client-id=xxxsecretidxxx&intent=authorize" data-sdk-integration-source="developer-studio"></script>

In my php-server-checkout-file i have the createOrder- and authorizeOrder-Funktion:

function createOrder($cart, $client)
{
$orderBody = [
"body" => OrderRequestBuilder::init("AUTHORIZE", [
PurchaseUnitRequestBuilder::init(AmountWithBreakdownBuilder::init("EUR", "10")->build())->build(),
])->build(),
];
$apiResponse = $client->getOrdersController()->createOrder($orderBody);
return handleResponse($apiResponse);
}

function authorizeOrder($orderID, $client)
{
$authorizeBody = ["id" => $orderID,];
$apiResponse = $client
->getOrdersController()
->authorizeOrder($authorizeBody);

return handleResponse($apiResponse);

}

Both are executed via ajax and are working (first createOrder, second authorizeOrder. I receive the status-completed data from Paypal.
But: The payment is executed immediatly and not just authorized.

Do i have to set the intent also somewhere else?

Best regards,
Otto

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions