# PayPal PlugIn: capture-authorization gibt Fehler "NotFound" zurück

**URL:** <https://forum.shopware.com/t/paypal-plugin-capture-authorization-gibt-fehler-notfound-zurueck/90324>\
**Category:** Programmierung\
**Tags:** programming\
**Created:** [14. September 2021 um 15:13 UTC](https://forum.shopware.com/t/paypal-plugin-capture-authorization-gibt-fehler-notfound-zurueck/90324 "2021-09-14T15:13:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reimers](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@Reimers](https://forum.shopware.com/u/Reimers)\
**Post date:** [14. September 2021 um 15:13 UTC](https://forum.shopware.com/t/paypal-plugin-capture-authorization-gibt-fehler-notfound-zurueck/90324/1 "2021-09-14T15:13:24Z")

</div>

Hallo!  
In unserem Shop wird bei Bestelleingang der Betrag beim Kunden nicht gleich abgebucht sondern nur reserviert. Der Zahlungsstatus steht dann auf „Autorisiert“.  
Nachdem die richtige Liefermenge an ShopWare zurück gemeldet wird, soll der Betrag korrigiert und von PayPal eingezogen werden.  
Dies versuche ich mit folgender Methode:

URI: /\_action/paypal-v2/capture-authorization/{orderTransactionId}/{authorizationId}  
JSON:  
{  
„amount“: „1.23“,  
„currency“: „EUR“,  
„invoiceNumber“: „Test4711“,  
„noteToPayer“: „geändert“,  
„isFinal“: true  
}

Als Rückmeldung erhalte ich: StatusCode: 404, ReasonPhrase: ‚Not Found‘.  
Was ist hier falsch bzw. was fehlt?  
Danke!

MfG, H.Reimers

---

<div class="post-metadata">

**Author:** ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)\
**Post date:** [15. September 2021 um 06:34 UTC](https://forum.shopware.com/t/paypal-plugin-capture-authorization-gibt-fehler-notfound-zurueck/90324/2 "2021-09-15T06:34:29Z")

</div>

> [@Reimers](#):
>
> /\_action/paypal-v2/capture-authorization/{orderTransactionId}/{authorizationId}

Woher hast du denn diese Route? Die gibt es doch gar nicht in den PayPal Controllern, daher der 404 Error.

vielleicht die hier?  
`/api/v{version}/_action/paypal/capture-payment/{resourceType}/{resourceId}/{orderId}`  
aus: `src/Payment/PayPalPaymentController.php`

---

<div class="post-metadata">

**Author:** ![Reimers](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@Reimers](https://forum.shopware.com/u/Reimers)\
**Post date:** [15. September 2021 um 07:00 UTC](https://forum.shopware.com/t/paypal-plugin-capture-authorization-gibt-fehler-notfound-zurueck/90324/3 "2021-09-15T07:00:47Z")

</div>

Die Route habe ich mit Swagger erhalten.

Was ist denn mit resourceType und resourceId gemeint?  
Danke!

---

<div class="post-metadata">

**Author:** ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)\
**Post date:** [15. September 2021 um 07:31 UTC](https://forum.shopware.com/t/paypal-plugin-capture-authorization-gibt-fehler-notfound-zurueck/90324/4 "2021-09-15T07:31:50Z")

</div>

Schau dir doch die Methode an, dann siehst du was es ist

```auto
    /**
     * @Route("/api/v{version}/_action/paypal/capture-payment/{resourceType}/{resourceId}/{orderId}", name="api.action.paypal.catpure_payment", methods={"POST"})
     *
     * @throws RequiredParameterInvalidException
     */
    public function capturePayment(
        Request $request,
        Context $context,
        string $resourceType,
        string $resourceId,
        string $orderId
    ): JsonResponse {
        $capture = $this->createCapture($request);

        switch ($resourceType) {
            case RelatedResource::AUTHORIZE:
                $captureResponse = $this->authorizationResource->capture(
                    $resourceId,
                    $capture,
                    $this->getSalesChannelIdByOrderId($orderId, $context)
                );
                break;
            case RelatedResource::ORDER:
                $salesChannelId = $this->getSalesChannelIdByOrderId($orderId, $context);
                $captureResponse = $this->ordersResource->capture($resourceId, $capture, $salesChannelId);
                break;
            default:
                throw new RequiredParameterInvalidException('resourceType');
        }

        $this->paymentStatusUtil->applyCaptureStateToPayment($orderId, $request, $context);

        return new JsonResponse($captureResponse);
    }

```

`$resourceType` muss entweder "authorize" oder "order" sein.  
`$resourceId` ist entweder die Id der Authorization oder der Order.

---

<div class="post-metadata">

**Author:** ![Reimers](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@Reimers](https://forum.shopware.com/u/Reimers)\
**Post date:** [15. September 2021 um 11:32 UTC](https://forum.shopware.com/t/paypal-plugin-capture-authorization-gibt-fehler-notfound-zurueck/90324/5 "2021-09-15T11:32:55Z")

</div>

Super danke!  
Ich habe es auf GitHub unter: shopwareLabes / SwagPayPal/src/PaymentsApi/Administration/PayPalPaymentController.php gefunden.  
(da muss man erst mal drauf kommen)

Die URI scheint jetzt wenigstens zu funktionieren:  
/api/\_action/paypal/capture-payment/authorize/{MeineResourceId}/{meineOrderId}

Ich erhalte allerdings den Fehler: status: 400, code: FRAMEWORK\_\_INVALID\_UUID, detail: Value is not a valid UUID: 1P99\_\_\_

Was hat das zu bedeuten?
