# m\_payment\_paypal\_api

Source: https://zotonic.com/docs/3175/m_payment_paypal_api

URI: https://zotonic.com/id/3175

Language: en



Create, capture and synchronize PayPal Orders and verify webhook events.

This module exposes trusted Erlang APIs and has no template model paths. `create(PaymentNr, Context)` creates an order for an existing local payment, returning `{ok, #payment_psp_handler{}}` or an error. Recurring creation is unsupported.

For example, `m_payment_paypal_api:fetch_order(OrderId, Context)` returns `{ok, OrderMap}` or `{error, Reason}`. `capture_order/2` captures an approved order; `sync_order_status/2` refreshes its local status. `ping(Context)` returns `ok` if configured credentials can obtain an OAuth token, or `{error, Reason}`.

Credentials and the live/sandbox selection come from mod\_payment\_paypal settings. Webhook signature verification uses `webhook_id` and PayPal's verification API. `webhook_event/2` processes already verified events; callers must not send unverified request bodies directly to it. Direct calls do not enforce administrative ACLs.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/3175?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/3175?language=en>)
