Empowering Rapyd Payments with OpenAPI

By @Nirit_Markovich

OpenAPI, formerly known as Swagger, is a specification for designing, documenting, and consuming RESTful APIs (Application Programming Interfaces). OpenAPI provides a standardized way to describe the structure, operations, and functionality of an API. OpenAPI allows developers to generate documentation, create client SDKs (Software Development Kits), and automate API-related tasks.

Why OpenAPI Matters for Rapyd

What is it that makes OpenAPI a valuable tool for developers? Here are some reasons why we would use OpenAPI at Rapyd.

API Documentation: OpenAPI allows us to generate interactive and user-friendly documentation for our API. It provides a machine-readable format that can be easily consumed by developers, making it easier for them to understand how to use our API effectively.

Design-First Approach: OpenAPI promotes a design-first approach to building APIs. By defining the API specification upfront, we can ensure consistency and clarity in the API’s structure and behavior. This helps both the Product managers and Engineers to build the API, and the developer community to have a clear understanding of the API contract. You can think of an API contract as a recipe that tells two pieces of software how to talk to each other. Just as a cookbook that gives specific instructions on ingredients, and cooking steps the API contract will set rules on defining endpoints, data formats, and behavior to ensure seamless integration and interoperability.

Code Generation: OpenAPI specifications can be used to automatically generate client SDKs, server stubs, and other code artifacts. This saves time and effort by eliminating the need to write boilerplate code for API integration. Generated SDKs can provide a convenient way for developers to interact with our API using their preferred programming language.

Testing and Validation: OpenAPI specifications can be used to validate API requests and responses. We perform automated testing against the specification to ensure the API implementation adheres to the defined contract. This helps identify potential issues and inconsistencies early in the development process.

API Governance and Collaboration: OpenAPI provides a common language and format for describing APIs, making it easier for teams to collaborate on API design and development. It allows for better communication between API providers and consumers, enabling teams to work together effectively.

Empowering API Developers

Once we publish an OpenAPI specification, consumers can use it to understand and interact with our API.

Here’s how consumers can leverage the OpenAPI specification:

Manual Integration: Developers can manually integrate with our API by referring to the OpenAPI specification. They can use the specification to understand the structure of the API’s endpoints, the expected request payloads, and the format of the responses. By following the API contract defined in the OpenAPI specification, consumers can manually write code to make HTTP requests and handle the API responses in their preferred programming language.

Code Generation: OpenAPI allows for automatic code generation, which simplifies API integration for consumers. The OpenAPI specification can be used with code generation tools, such as Swagger Codegen or OpenAPI Generator, to generate client SDKs or libraries in various programming languages. These generated SDKs provide pre-built functions and classes that abstract away the low-level details of making API requests and handling responses. Consumers can then import these SDKs into their projects and use the provided methods and classes to interact with our API more easily.

API Explorers: Many API development platforms and tools provide built-in API explorers that can consume the OpenAPI specification and provide an interactive interface for testing and exploring the API. These explorers allow consumers to make API requests, view responses, and experiment with different parameters. Swagger UI and ReDoc are popular examples of API explorers that can consume OpenAPI specifications.

API Gateway Configuration: API management servers typically include an API gateway component that handles the routing and forwarding of API requests. By importing the OpenAPI specification into the API management server, the gateway can automatically configure the necessary routing rules based on the defined endpoints and paths in the specification. This simplifies the setup process and ensures that incoming requests are properly routed to the corresponding backend services.

Examples for use OpenAPI in API Management Gateways:

Getting started with Rapyd OpenAPI on Postman

  1. Go to Postman and goto Collections > Select Fork.
  2. Go to Environments, select the three dots next to RapydSB openAPI > Select Fork.

As you fork both the Collection and Environment, you can import them into your own designated environment.

  1. Sign-up to Rapyd Client Portal,
  2. Grab your API credentials to copy the access and secret keys from the Developers tab.
  3. Paste the access and secret key into the Postman Environment.
  4. Test your collection by calling GET https://sandboxapi.rapyd.net/v1/data/countries.

Note: The endpoint in Postman should look like {{baseUrl}}/v1/data/countries.

Copy the OpenAPI into Swagger

  1. Go to the API section in Rapyd OpenAPI in Postman.
  2. Select the down arrow on Rapyd-api
  3. Select the down arrow on Definition.
  4. Select Rapyd-api-Beta.yaml or Rapyd-api.yaml.
  5. On the right panel, select the copy icon in between the wrap text and search icon.

  1. Go to the Swagger Editor and paste the OpenAPI in the content section.

Now you can look at generating samples and working on the Rapyd API right within Swagger.

For any questions you can open up a topic right here in 💻 OAS - Rapyd Dev Community


Thank you for the comprehensive guide, @Nirit_Markovich! :raised_hands:

Your detailed walkthrough simplifies the process of leveraging Rapyd’s OpenAPI capabilities, making it accessible for developers at all skill levels. It’s exciting to see how the integration of OpenAPI with Rapyd’s services can streamline workflows, from documentation to code generation and beyond.

For those who are about to embark on this journey, the outlined steps will certainly be a valuable resource. And remember, the community forum is there for support; whether you’re facing challenges or have insights to share, it’s a great place to connect with peers and experts alike.

Happy coding to all the Rapyd developers out there who are in the midst of your integration! If you have success stories, particular use cases, or tips from your experience integrating with Rapyd through OpenAPI, feel free to share your stories on the community forum. Your input could be immensely beneficial to others!

For any troubleshooting or additional queries, the Rapyd community is ready to assist. Don’t hesitate to ask your questions or start a discussion at 💻 OpenAPI - Rapyd Dev Community.

1 Like