> For the complete documentation index, see [llms.txt](https://docs.verifone.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verifone.com/api-reference/open-api-references/paypal-ecommerce/risk-context.md).

# Risk Context

The **Risk Context** endpoint allows you to provide PayPal with session-level fraud signals before a transaction is submitted. This data is used by PayPal's fraud evaluation systems to assess transaction risk and can improve authorisation rates.

{% hint style="info" %}
Set the risk context before calling `POST /transactions` or `POST /transactions/{id}/authorize` to ensure the fraud signals are associated with the payment.
{% endhint %}

## How It Works

{% stepper %}
{% step %}

## Collect client-side signals

Gather the PayPal fraud session ID from the PayPal JavaScript SDK on the checkout page. This is typically available as a value from the PayPal client-side library.
{% endstep %}

{% step %}

## Submit the risk context

Call `POST /transactions/risk/context` with the collected fraud signals. You receive a context token in the response.
{% endstep %}

{% step %}

## Include the fraud ID in the transaction

Pass the fraud ID as the `paypalFraudId` header when calling `POST /transactions` or `POST /transactions/{id}/authorize`.
{% endstep %}
{% endstepper %}

## Set Transaction Context

## POST /transactions/risk/context

> Set transaction context

```json
{"openapi":"3.0.1","info":{"title":"PayPal eComm API","version":"1.6.0"},"servers":[{"url":"https://emea.gsc.verifone.cloud/oidc/paypal-ecom","description":"EMEA Production"},{"url":"https://us.gsc.verifone.cloud/oidc/paypal-ecom","description":"Americas Production"},{"url":"https://nz.gsc.verifone.cloud/oidc/paypal-ecom","description":"New Zealand"},{"url":"https://cst.test-gsc.vfims.com/oidc/paypal-ecom","description":"Global Sandbox"},{"url":"https://uscst.gb.gsc.cficloud/oidc/paypal-ecom","description":"Americas Sandbox"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"Model44":{"required":["paymentProviderContract"],"type":"object","properties":{"paymentProviderContract":{"type":"string","description":"Payment Provider contract"},"trackingId":{"type":"string","description":"A unique ID to track each transaction"},"data":{"$ref":"#/components/schemas/details"}}},"details":{"type":"object"},"Model45":{"required":["trackingId"],"type":"object","properties":{"trackingId":{"type":"string","description":"A unique ID to track each transaction"}}},"Model5":{"required":["code","message"],"type":"object","properties":{"code":{"type":"number","description":"A 3-digit code which uniquely identify an error."},"details":{"$ref":"#/components/schemas/details"},"message":{"type":"string","description":"A description of the error."},"timestamp":{"type":"string","description":"Error timestamp","format":"date"}}}}},"paths":{"/transactions/risk/context":{"post":{"tags":["Transactions"],"summary":"Set transaction context","operationId":"postTransactionsRiskContext","requestBody":{"content":{"*/*":{"schema":{"$ref":"#/components/schemas/Model44"}}},"required":false},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model45"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model5"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model5"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model5"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model5"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Model5"}}}}}}}}}
```

## Using the paypalFraudId Header

The `paypalFraudId` header is accepted on the following endpoints:

* `POST /transactions` — Create Transaction
* `POST /transactions/{id}/authorize` — Authorize Transaction

Pass the GUID value returned from the risk context response as `paypalFraudId` in those requests.

{% hint style="success" %}
Always set risk context before initiating or authorising transactions in checkout flows. Including fraud signals improves PayPal's ability to approve legitimate transactions.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verifone.com/api-reference/open-api-references/paypal-ecommerce/risk-context.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
