1. Pay In Request

A Pay In transaction occurs when a Customer starts a direct deposit in the Merchant website.

This algorithm outlines the expected steps and procedures to be followed in the Pay In process with Pay4Fun:

Receives an API request from Merchant and store it under a Key for further recover

post
Header parameters
merchantIdinteger · int64Optional
hashstringOptional
Body
amountnumber · currencyRequiredPattern: ^(?!0|\.00)[0-9]+((,|\.)\d{3})*(.[0-9]{0,2})?$
merchantInvoiceIdstring · max: 255Required
languagestring | nullableOptional
currencystring · max: 3Required
okUrlstring · uri · max: 600Required
notOkUrlstring · uri · max: 600Required
confirmationUrlstring · uri · max: 600Required
hashstring | nullableOptional
p4fAccountEmailstring | nullableOptional
p4fMainIdstring | nullableOptional
merchantLogostring · uri | nullableOptional
layoutColorstring | nullableOptional
labelIdinteger · int64 | nullableOptional
paymentMethodIdinteger · int32Optional
paymentMethodstring | nullableOptional
fullNamestring | nullableOptional
lockByNamebooleanOptional
birthDatestring | nullableOptional
emailstring | nullableOptional
zipcodestring | nullableOptional
Responses
200

Success

post
/1.0/Go/Process
POST /1.0/Go/Process HTTP/1.1
Host: 
Content-Type: application/json-patch+json
Accept: */*
Content-Length: 436

{
  "amount": 1,
  "merchantInvoiceId": "text",
  "language": "text",
  "currency": "text",
  "okUrl": "https://example.com",
  "notOkUrl": "https://example.com",
  "confirmationUrl": "https://example.com",
  "hash": "text",
  "p4fAccountEmail": "text",
  "p4fMainId": "text",
  "merchantLogo": "https://example.com",
  "layoutColor": "text",
  "labelId": 1,
  "paymentMethodId": 1,
  "paymentMethod": "text",
  "fullName": "text",
  "lockByName": true,
  "birthDate": "text",
  "email": "text",
  "zipcode": "text"
}
{
  "code": 201,
  "message": "success"
}

1. Send a Pay In Request:

  • You initiate the process by sending us a Pay In request.

  • Purpose of this request is allow your customers authenticate their Pay4Fun’s wallet. (No transaction will be generated due this request)

Receives an API request from Merchant and store it under a Key for further recover

post
Header parameters
merchantIdinteger · int64Optional
hashstringOptional
Body
amountnumber · currencyRequiredPattern: ^(?!0|\.00)[0-9]+((,|\.)\d{3})*(.[0-9]{0,2})?$
merchantInvoiceIdstring · max: 255Required
languagestring | nullableOptional
currencystring · max: 3Required
okUrlstring · uri · max: 600Required
notOkUrlstring · uri · max: 600Required
confirmationUrlstring · uri · max: 600Required
hashstring | nullableOptional
p4fAccountEmailstring | nullableOptional
p4fMainIdstring | nullableOptional
merchantLogostring · uri | nullableOptional
layoutColorstring | nullableOptional
labelIdinteger · int64 | nullableOptional
paymentMethodIdinteger · int32Optional
paymentMethodstring | nullableOptional
fullNamestring | nullableOptional
lockByNamebooleanOptional
birthDatestring | nullableOptional
emailstring | nullableOptional
zipcodestring | nullableOptional
Responses
200

Success

post
/1.0/Go/Process
POST /1.0/Go/Process HTTP/1.1
Host: 
Content-Type: application/json-patch+json
Accept: */*
Content-Length: 436

{
  "amount": 1,
  "merchantInvoiceId": "text",
  "language": "text",
  "currency": "text",
  "okUrl": "https://example.com",
  "notOkUrl": "https://example.com",
  "confirmationUrl": "https://example.com",
  "hash": "text",
  "p4fAccountEmail": "text",
  "p4fMainId": "text",
  "merchantLogo": "https://example.com",
  "layoutColor": "text",
  "labelId": 1,
  "paymentMethodId": 1,
  "paymentMethod": "text",
  "fullName": "text",
  "lockByName": true,
  "birthDate": "text",
  "email": "text",
  "zipcode": "text"
}
{
  "code": 201,
  "message": "success"
}

Transaction Parameters

The following table provides a list of parameters required for transaction processing:

Parameter
Type
Description
Required

hash

String

Anti-fraud hash. Refer to Appendix 1 for generation details.

Yes

amount

Decimal

Payment amount with up to 2 decimal places.

Yes

merchantInvoiceId

String

Unique transaction ID for merchants. Maximum of 250 characters.

Yes

language

String

Preferred language for customer: pt-BR, en-US, or es-ES.

No

currency

String

Currency code as per ISO 4217 (3 characters). Supported Currencies: BRL, GBP, USD, EUR.

Yes

okUrl

String

Redirection URL upon successful transaction.

Yes

notOkUrl

String

Redirection URL upon transaction failure.

Yes

confirmationUrl

String

URL for merchant’s transaction confirmation.

Yes

labelId

Integer

Label for transaction tagging. Refer to Appendix 3 for details.

No

Make sure to send the correct information to the API. Pay4Fun takes no responsibility for incorrect amount or currency parameters sent to the API.

Onboard Data Parameters

To enhance the user experience, you can provide your customer's personal data. If provided, we'll automatically populate the appropriate fields during the transaction process. Otherwise, the customer will be prompted to enter this information themselves.

Note: We only process the customer's initial data submission. Subsequent submissions of the same data will be ignored, so it's only necessary to send this information once.

Parameter
Type
Description
Required

zipcode

String

Brazilian postal code.

No

email

String

Customer's email address.

No

birthDate

String

Birthdate in yyyy-MM-dd format.

No

fullName

String

Customer's full name.

No

p4fMainId

String

Customer's CPF.

No

Payment Method Parameters

  1. Display Pay4Fun GO as a Single Icon: By doing this, you should avoid specifying any Payment Method parameters in your request. We will present all available payment methods, letting the customer select their preferred option.

  2. Use Individual Icons for Each Payment Method: If you opt for this, include just ONE of the parameters—either paymentMethod or paymentMethodId—in your request. Based on this, we'll guide the customer directly to the confirmation screen for their chosen payment method.

Parameter
Type
Description
Required

paymentMethod

String

Desired Payment Method: PIX, Boleto, or BankTransfer.

No

paymentMethodId

Integer

Check Error! Not a valid result for table. section for more details

No

Branding

Parameter
Type
Description
Required

merchantLogo

String

Merchant logo URL (https). Max height: 40 pixels.

No

layoutColor

String

Hexadecimal color code.

No

Want to change the look of Pay4Fun's interface? You can!
  1. Change the Header Color: Use the "layoutColor" parameter and provide a color code (like #FF5733).

  2. Add Your Logo: Use the "merchantLogo" parameter and give the link to your logo image.

Just remember to include these when making Pay In requests.

Pay in hash seed string generation

To generate the seed string for hash creation in Pay in requests (See Appendix – Generating the Hash), follow the concatenation order below:

  1. Merchant’s ID

  2. Pay in amount (expressed in cents and always including two decimal places)

  3. Merchant’s invoice ID

  4. Merchant’s secret

Example: Consider a Pay in request of $10.00 USD tied to merchant’s invoice ID ABC777. Given:

  • Merchant’s ID: 34567

  • Merchant’s secret: abcdef

The resulting seed string becomes:

codeSeed string = 345671000ABC777abcdef

Security Note: The Merchant's secret is crucial for hash integrity. Ensure it remains confidential to prevent unauthorized hash generation.

Key Point: Always include cents in the seed string, even for whole amounts like $1000.00.

The P4F API will generate its hash for verification. If there's a mismatch, likely due to an attempt to forge a request without the authentic Merchant's secret, the transaction will be declined.

Payment Methods

Retrieve a List of Payment Methods available for P4F GO API

get
Header parameters
merchantIdstringOptional
hashstringOptional
Responses
200

Success

get
/1.0/Go/PaymentMethods
GET /1.0/Go/PaymentMethods HTTP/1.1
Host: 
Accept: */*
[
  {
    "paymentMethodId": 1,
    "name": "text",
    "paymentMethodTypeName": "text"
  }
]

How to Create a Seed String for Payment Methods:

To make a seed string for hash generation:

  1. Start with the Merchant's ID.

  2. Add the Merchant's Secret.

For detailed hash generation, see Appendix 1.

Example: If your Merchant's ID is 34567 and Secret is abcdef, then: Seed string = 34567abcdef

Example of a Payment Method Request:

[
  {
    "paymentMethodId": 1987,
    "name": "Itau",
    "paymentMethodTypeName": "Bank Transfer"
  },
  {
    "paymentMethodId": 2009,
    "name": "PIX",
    "paymentMethodTypeName": "Bank Transfer"
  }
  // ... other payment methods
]

Last updated

Was this helpful?