PicPay - E-commerce Public API
PicPay é o app que faz com que seus pagamentos sejam mais simples e rápidos, do jeito que você precisa. Com o PicPay você recebe e envia dinheiro para outras pessoas, paga contas, estabelecimentos, compra créditos para o celular e muito mais. Tudo isso na hora, direto do seu celular.
Installation
Add this line to your application's Gemfile:
gem 'picpay'
# or
gem 'picpay', :git => 'https://github.com/gilcierweb/picpay'
And then execute:
$ bundle
Or install it yourself as:
$ gem install picpay
Usage
# Seller
picpay_token = 'my_picpay_token'
seller_token = 'my_seller_token'
api_url = 'https://appws.picpay.com/ecommerce/public/payments' # optional
picpay = Picpay::Picpay.new(picpay_token, seller_token)
# Buyer
picpay.first_name = 'Fulano'
picpay.last_name = 'Da Silva Sousa'
picpay.document = '123.456.789-10'
picpay.email = 'teste@gilcierweb.com.br'
picpay.phone = '+55 85 12345-6789'
# Payment
picpay.reference_id = '102030'
picpay.callback_url = 'http://www.sualoja.com.br/callback'
picpay.return_url = 'http://www.sualoja.com.br/cliente/pedido/102030' # optional
picpay.value = 45.55 # format decimal
picpay.expires_at = '20/09/2022 00:00 -03:00' # optional gem convert to format correct ISO 8601 ex: 2022-05-01T16:00:00-03:00
# Payment Request
payment_request = picpay.payments()
payment_request.status
# => 200
payment_request.headers
# => {"server"=>"app.picpay.com", "content-type"=>"application/json; charset=utf-8"...
payment_request.body
response = payment_request.body.force_encoding('ASCII-8BIT').force_encoding('UTF-8') # optional case error utf-8
# => "{referenceId: "102030"...
reference_id = '102030'
authorization_id = '555008cef7f321d00ef236333'
#Payment Cancellation
payment_cancellation = picpay.payments_cancellations(reference_id, authorization_id)
payment_cancellation.status
# => 200
payment_cancellation.headers
# => {"server"=>"app.picpay.com", "content-type"=>"application/json; charset=utf-8"...
payment_cancellation.body
response = payment_cancellation.body.force_encoding('ASCII-8BIT').force_encoding('UTF-8') # optional case error utf-8
# => "{referenceId: "102030"...
# Payment Status
payment_status = picpay.payments_status(reference_id)
payment_status.status
# => 200
payment_status.headers
# => {"server"=>"app.picpay.com", "content-type"=>"application/json; charset=utf-8"...
payment_status.body
response = payment_status.body.force_encoding('ASCII-8BIT').force_encoding('UTF-8') # optional case error utf-8
# => "{referenceId: "102030"...
Example of Payment Request (JSON)
{
"referenceId": "102030",
"callbackUrl": "http://www.sualoja.com.br/callback",
"returnUrl": "http://www.sualoja.com.br/cliente/pedido/102030",
"value": 20.51,
"expiresAt": "2022-05-01T16:00:00-03:00",
"buyer":
{
"firstName": "Fulano",
"lastName": "Da Silva Sousa",
"document": "123.456.789-10",
"email": "teste@gilcierweb.com.br",
"phone": "+55 27 12345-6789"
}
}
Example of Payment Response (JSON)
{
"referenceId": "102030",
"paymentUrl": "https://app.picpay.com/checkout/NWFmMGRjNmViZDc0Y2EwMDMwNzZlYzEw",
"expiresAt": "2022-05-01T16:00:00-03:00",
"qrcode":
{
"content": "https://app.picpay.com/checkout/NWNlYzMxOTM1MDg1NGEwMDIwMzUxODcy",
"base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAIAAAAP3aGbAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAIHklEQVR4nO3dwW4bORRFQcfI/3+yMYsBZmfCYTjUO62qbRC5LckHvbhg//r6+voAKPh89QUA/JRgARmCBWQIFpAhWECGYAEZggVkCBaQIVhAhmABGYIFZAgWkCFYQIZgARmCBWQIFpAhWECGYAEZggVkCBaQIVhAhmABGYIFZAgWkCFYQIZgARmCBWQIFpAhWECGYAEZggVkCBaQIVhAhmABGYIFZAgWkCFYQIZgARmCBWQIFpAhWECGYAEZggVkCBaQIVhAhmABGYIFZAgWkCFYQIZgARm/X30B3/r8DMf06+vru3/a+70WL7jn+GUsXnDv4o+/4M2f9dRv78uF31bg3QgWkCFYQIZgARmCBWQIFpAhWECGYAEZc4ejC0OGbUMmoHuOT1sX9maZQ+amx19wyBcgOm1NXjTwngQLyBAsIEOwgAzBAjIEC8gQLCBDsICM5HB04fgc7g0Pt7y5hxxy8TdfcGH+u/Fy7rCADMECMgQLyBAsIEOwgAz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QLCBDsIAMwQIyBAvIECwgQ7CADMECMgQLyBAsIEOwgAzBAjIEC8gQLCBDsIAMwQIyBAvIECwgQ7CADMECMgQLyBAsIOMfNhb2ttAasncAAAAASUVORK5CYII="
}
}
Example of Payment Cancellation Request (JSON)
{
"authorizationId": "555008cef7f321d00ef236333"
}
Example of Payment Cancellation Response (JSON)
{
"referenceId": "102030",
"cancellationId": "5b008cef7f321d00ef236444"
}
Example of Payment Status Request (JSON)
get https://appws.picpay.com/ecommerce/public/payments/{referenceId}/status
Example of Payment Status Response (JSON)
{
"authorizationId": "555008cef7f321d00ef236333",
"referenceId": "102030",
"status": "paid"
}
Example of Payment Notification Request (JSON)
post http://www.sualoja.com.br/callback
Example of Payment Notification Response (JSON)
{
"referenceId": "102030",
"authorizationId": "5b01780ba8914c001a007673"
}
return status 200 in your api callback
Doação / Donate
Doar com PagSeguro 5,00, 10,00, 15,00, 20,00, 30,00, 40,00 ou outro valor
Consultoria / Consulting
Site
PicPay Site
PicPay Documentation API
https://ecommerce.picpay.com/doc/
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/picpay. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Picpay project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.