## Confirm Stripe payment intent

### cURL

```bash
curl --request POST \
  --url https://prod01-apigw.yourcompany.fabric.zone/ext-stripe/payment-intent/confirm/{paymentIntentId} \
  --header 'Content-Type: application/json' \
  --data '\n{\n  "payment_method": "pi_1GsyhzFbKq2PvwXbwAI3ZluI",\n  "receipt_email": "joedoe@fabric.inc",\n  "setup_future_usage": "off_session"\n}\n'\n```

### Python

```python
import requests

url = "https://prod01-apigw.yourcompany.fabric.zone/ext-stripe/payment-intent/confirm/{paymentIntentId}"

payload = {\n    "payment_method": "pi_1GsyhzFbKq2PvwXbwAI3ZluI",\n    "receipt_email": "joedoe@fabric.inc",\n    "setup_future_usage": "off_session"\n}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### JavaScript Fetch

```javascript
const options = {\n  method: 'POST',\n  headers: {'Content-Type': 'application/json'},\n  body: JSON.stringify({\n    payment_method: 'pi_1GsyhzFbKq2PvwXbwAI3ZluI',\n    receipt_email: 'joedoe@fabric.inc',\n    setup_future_usage: 'off_session'\n  })\n};

fetch('https://prod01-apigw.yourcompany.fabric.zone/ext-stripe/payment-intent/confirm/{paymentIntentId}', options)\n  .then(res => res.json())\n  .then(res => console.log(res))\n  .catch(err => console.error(err));
```

### PHP

```php
$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://prod01-apigw.yourcompany.fabric.zone/ext-stripe/payment-intent/confirm/{paymentIntentId}",\
  CURLOPT_RETURNTRANSFER => true,\
  CURLOPT_ENCODING => "",\
  CURLOPT_MAXREDIRS => 10,\
  CURLOPT_TIMEOUT => 30,\
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
  CURLOPT_CUSTOMREQUEST => "POST",\
  CURLOPT_POSTFIELDS => json_encode([\
    'payment_method' => 'pi_1GsyhzFbKq2PvwXbwAI3ZluI',\
    'receipt_email' => 'joedoe@fabric.inc',\
    'setup_future_usage' => 'off_session'\
  ]),\
  CURLOPT_HTTPHEADER => [\
    "Content-Type: application/json"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {\
  echo "cURL Error #:" . $err;\
} else {\
  echo $response;\
}
```

### Go

```go
package main

import (\n\t"fmt"\n\t"strings"\n\t"net/http"\n\t"io"\n)

func main() {

\turl := "https://prod01-apigw.yourcompany.fabric.zone/ext-stripe/payment-intent/confirm/{paymentIntentId}"

\tpayload := strings.NewReader("{\n  \"payment_method\": \"pi_1GsyhzFbKq2PvwXbwAI3ZluI\",\n  \"receipt_email\": \"joedoe@fabric.inc\",\n  \"setup_future_usage\": \"off_session\"\n}")

\treq, _ := http.NewRequest("POST", url, payload)

\treq.Header.Add("Content-Type", "application/json")

\tres, _ := http.DefaultClient.Do(req)

\tdefer res.Body.Close()
\tbody, _ := io.ReadAll(res.Body)

\tfmt.Println(string(body))
}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://prod01-apigw.yourcompany.fabric.zone/ext-stripe/payment-intent/confirm/{paymentIntentId}")\n  .header("Content-Type", "application/json")\n  .body("{\n  \"payment_method\": \"pi_1GsyhzFbKq2PvwXbwAI3ZluI\",\n  \"receipt_email\": \"joedoe@fabric.inc\",\n  \"setup_future_usage\": \"off_session\"\n}")\n  .asString();
```

### Ruby

```ruby
require 'uri'\nrequire 'net/http'\n
url = URI("https://prod01-apigw.yourcompany.fabric.zone/ext-stripe/payment-intent/confirm/{paymentIntentId}")\n
http = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n
\nrequest = Net::HTTP::Post.new(url)\nrequest["Content-Type"] = 'application/json'\nrequest.body = "{\n  \"payment_method\": \"pi_1GsyhzFbKq2PvwXbwAI3ZluI\",\n  \"receipt_email\": \"joedoe@fabric.inc\",\n  \"setup_future_usage\": \"off_session\"\n}"\n
response = http.request(request)\nputs response.read_body
```

### Response Formats

#### Successful Response (200)

```json
{
  "id": "pi_1GsyhzFbKq2PvwXbwAI3ZluI",
  "object": "payment_intent",
  "amount": 1000,
  "amount_capturable": 0,
  "amount_received": 0,
  "application": "<string>",
  "application_fee_amount": 123,
  "canceled_at": "<string>",
  "cancellation_reason": "<string>",
  "capture_method": "manual",
  "client_secret": "pi_1GsyhzFbKq2Pvw1bwAI3ZluI_secret_GKG6hcap7VCggeoqJICAqSsRW",
  "confirmation_method": "automatic",
  "created": 1591913835,
  "currency": "usd",
  "customer": "<string>",
  "description": "<string>",
  "invoice": "<string>",
  "last_payment_error": "<string>",
  "livemode": true,
  "metadata": {},
  "next_action": "<string>",
  "on_behalf_of": "<string>",
  "payment_method": "<string>",
  "payment_method_options": {
    "card": {
      "installments": "<string>",
      "network": "<string>",
      "request_three_d_secure": "automatic"
    }
  },
  "payment_method_types": ["card"],
  "receipt_email": "<string>",
  "review": "<string>",
  "setup_future_usage": "on_session",
  "shipping": "<string>",
  "source": "<string>",
  "statement_descriptor": "<string>",
  "statement_descriptor_suffix": "<string>",
  "status": "requires_payment_method",
  "transfer_data": "<string>",
  "transfer_group": "<string>",
  "billing_details": {
    "address": {
      "line1": "3520 Millenio",
      "city": "Vancouver",
      "state": "BC",
      "country": "CA",
      "postal_code": "V5R 6G9",
      "line2": "Crowley Drive"
    },
    "name": "John Smith",
    "email": "john@fabric.inc",
    "phone": "123-456-7890"
  },
  "charges": {
    "object": "list",
    "data": [{
      "id": "ch_1GszZAFbKq2PvwXbWRHwiXg0",
      "object": "charge",
      "amount": 1500,
      "amount_refunded": 0,
      "application": "<string>",
      "application_fee": "<string>",
      "application_fee_amount": "<string>",
      "balance_transaction": "<string>",
      "calculated_statement_descriptor": "Stripe",
      "captured": false,
      "created": 1591917132,
      "currency": "usd",
      "customer": "<string>",
      "description": "<string>",
      "destination": "<string>",
      "dispute": false,
      "disputed": "<string>",
      "failure_code": "<string>",
      "failure_message": "<string>",
      "fraud_details": {},
      "invoice": "<string>",
      "livemode": false,
      "metadata": "<string>",
      "on_behalf_of": "<string>",
      "order": "<string>",
      "outcome": {
        "network_status": "approved_by_network",
        "reason": "<string>",
        "risk_level": "normal",
        "risk_score": 7,
        "seller_message": "Payment complete.",
        "type": "authorized"
      },
      "paid": true,
      "payment_intent": "pi_1GsyhzFbKq2PvwXbwAI3ZluI",
      "payment_method": "pm_1GszYCFbKq2PvwXb2CDbdZOP",
      "payment_method_details": {
        "card": {
          "brand": "visa",
          "checks": {
            "address_line1_check": "<string>",
            "address_postal_code_check": "pass",
            "cvc_check": "pass"
          },
          "country": "US",
          "exp_month": 3,
          "exp_year": 2023,
          "fingerprint": "KYFNiC9k7gBUEnMg",
          "funding": "credit",
          "installments": "<string>",
          "last4": "4242",
          "network": "visa",
          "three_d_secure": "<string>",
          "wallet": "<string>"
        },
        "type": "card"
      },
      "receipt_email": "<string>",
      "receipt_number": "<string>",
      "receipt_url": "https://pay.stripe.com/receipts/acct_1GrptTFbKq2PvwXb/ch_1GszZAFbKq2PvwXbWRHwiXg0/rcpt_HRtLuMrk7E5VQ1rLWNVzKrXHFZHHczr",
      "refunded": false,
      "refunds": {
        "object": "list",
        "data": "<array>",
        "has_more": false,
        "total_count": 0,
        "url": "/v1/charges/ch_1GszZAFbKq2PvwXbWRHwiXg0/refunds"
      },
      "review": "<string>",
      "shipping": "<string>",
      "source": "<string>",
      "source_transfer": "<string>",
      "statement_descriptor": "<string>",
      "statement_descriptor_suffix": "<string>",
      "status": "succeeded",
      "transfer_data": "<string>",
      "transfer_group": "<string>"
    }],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/charges?payment_intent=pi_1GsyhzFbKq2PvwXbwAI3ZluI"
  }
}
```

#### Error Responses

**Expected error response formats**:

```json
{
  "code": "<string>",
  "message": "<string>"
}
```

```json
{
  "message": "Forbidden"
}
```

---

### Headers

- **x-api-key**
  - string
  - Example: `"0LybWR49k95cCwYh3cu0waCYoh4H2Eux2J52wn4k"`

### Path Parameters

- **paymentIntentId**
  - string
  - required
  - Payment intent Id.

### Body

- **application/json**

**Required Fields**:
- **payment_method** (string)
  - Example: `
