Fluent Commerce Logo
Docs
Sign In

payment graphQL query and mutation

Essential knowledge

Author:

Fluent Commerce

Changed on:

9 Dec 2024

Overview

The

`payment`
is an entity that is required as part of the payment process. 


Key points

  • The page provides GQL example of how to use
    `payment`
    :
    • Create
    • Update
    • Query

Create

1POST: {{fluentApiHost}}/graphql
2
3QUERY:
4
5
6
7mutation createPayment ($input: CreatePaymentInput) {
8    createPayment (input: $input) {
9        id
10        ref
11        type
12        status
13        createdOn
14        updatedOn
15    }
16}
17Variables:
18
19
20
21{
22  "input": {
23    "ref": "PAYMENT000002",
24    "type": "DEFAULT",
25    "status": "ACTIVE",
26    "retailer": {
27      "id": 199
28    },
29    "amount": {
30      "amount": "3.00",
31      "scale": 2,
32      "unscaledValue": 300
33    },
34    "paymentTransactions": {
35      "ref": "PAYMENT000002",
36      "type": "PT_TYPE1",
37      "status": "ACTIVE",
38      "amount": {
39        "amount": "654.11",
40        "scale": 1,
41        "unscaledValue": 1
42      },
43      "currency": {
44        "alphabeticCode": "AUD"
45      },
46      "authorizationKey": "1234567",
47      "cardType": "VISA",
48      "paymentMethod": "CARD",
49      "paymentServiceProvider": {
50        "ref": "PSP002:199"
51      },
52      "attributes": {
53        "name": "PaymentType",
54        "type": "STRING",
55        "value": "HELLO TYPE"
56      }
57    },
58    "billingAccount": {
59      "ref": "199_Ivory_Predovic@yahoo.com:199_MAN05"
60    },
61    "attributes": {
62      "name": "payment_Attr_Name",
63      "type": "STRING",
64      "value": "TEST01"
65    }
66  }
67}

Language: graphqlschema

Name: payment create example

Description:

payment create example

Update

1POST: {{fluentApiHost}}/graphql
2
3Query
4
5
6
7mutation updatePayment ($input: UpdatePaymentInput) {
8    updatePayment (input: $input) {
9        id
10        ref
11        type
12        status
13        createdOn
14        updatedOn
15    }
16}
17Variables
18
19
20
21{
22  "input": {
23    "ref": "PAYMENT000001",
24    "status": "DELETED"
25  }
26}

Language: graphqlschema

Name: payment update example

Description:

payment update example

Query

1POST: {{fluentApiHost}}/graphql
2
3Query:
4
5
6
7{
8    payment(ref:"PAYMENT000002"){
9                amount{ 
10                    amount
11                    scale
12                    unscaledValue
13                }
14                id
15                ref
16                status
17                billingAccount{
18                    ref
19                    id
20                }
21                createdOn
22                creditMemo{
23                    ref
24                    id
25                }
26                financialTransaction{
27                    id
28                    ref
29                }
30                fulfilment{
31                    id
32                    ref
33                }
34                orders{
35                    edges{
36                        node{
37                            id
38                            ref
39                        }
40                    }
41                }
42                status
43                type
44
45            }
46
47}

Language: graphqlschema

Name: payment query example

Description:

payment query example

1POST: {{fluentApiHost}}/graphql
2
3Query:
4
5
6
7{
8    payments{
9        edges{
10            node{
11                amount{ 
12                    amount
13                    scale
14                    unscaledValue
15                }
16                id
17                ref
18                status
19                paymentTransactions{
20                    edges{
21                        node{
22                            id
23                            ref
24                        }
25                    }
26                }
27                billingAccount{
28                    ref
29                    id
30                }
31                createdOn
32                creditMemo{
33                    ref
34                    id
35                }
36                financialTransaction{
37                    id
38                    ref
39                }
40                fulfilment{
41                    id
42                    ref
43                }
44                orders{
45                    edges{
46                        node{
47                            id
48                            ref
49                        }
50                    }
51                }
52                status
53                type
54
55            }
56        }
57    }
58}

Language: graphqlschema

Name: payments query example

Description:

payments query example

Fluent Commerce

Fluent Commerce