If sequential order numbers are on, those numbers are returned in the sales API instead of the actual payment record's ID. This adds the true payment ID to each sale in the API.
<?php
/*
 * Plugin Name: Easy Digital Downloads - Add Payment ID to Sales API
 * Description: If sequential order numbers are on, those numbers are returned in the sales API instead of the actual payment record's ID. This adds the true payment ID to each sale in the API.
 * Author: Kyle Maurer
 * Author URI: https://easydigitaldownloads.com/
 * Version: 1.0
 */

function kjm_add_payment_id_to_sales_endpoint( $sales ) {
	
	foreach ( $sales['sales'] as $sale => $data ) {
		// If sequential order numbering is on, the ID key will be a string
		$payment = ( is_string( $data['ID'] ) ) ? edd_get_payment_by('payment_number', $data['ID']) : $data['ID'];
		$payment_id = ( is_object( $payment ) ) ? $payment->ID : $payment;
		$sales['sales'][$sale]['payment_id'] = $payment_id;
	}

	return $sales;
}
add_filter( 'edd_api_sales', 'kjm_add_payment_id_to_sales_endpoint' );
To implement this snippet on your site, create a brand new, empty WordPress plugin and paste the above code inside.